Lua - 时间

 获取当前时间戳

local now = os.time()

 时间戳转换为时间字符串


local str = os.date("%Y/%m/%d %H:%M:%S", now)    --now:时间戳

时间戳转换为年月日时分秒

local time = os.date("*t", os.time())
--time.year, time.month, time.day
--time.hour, time.minute, time.second

猜你喜欢

转载自blog.csdn.net/smile_otl/article/details/133863549
LUA