os.date 获取当前时间

-- 获取系统时间
local unixTime = os.time()

-- 打印:年 月 日 时 分 秒
local year = tonumber(os.date("%Y",unixTime))
local month = tonumber(os.date("%m",unixTime))
local day = tonumber(os.date("%d",unixTime))
local hour = tonumber(os.date("%H",unixTime))
local minute = tonumber(os.date("%M",unixTime))
local second = tonumber(os.date("%S",unixTime))

os.time()

-- 当前时间: 
print( os.date("当前中国时间:%Y年%m月%d日 %H时%M分%S秒", os.time()) )

os.date(":%Y年%m月%d日 %H時%M分%S秒",loginTime)

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注