很早之前就想试下写写博客记录一些小问题,一直没去做,现在就从这个小问题做起吧
os.time()跟os.date()获取的时间都算了时区的,但不一定符合需求,如果游戏中开活动要按在固定时区的时间来操作的可能会需要计算出当前时区再来算出你想要时间。
function text()
local a = os.date('!*t',os.time())--中时区的时间
local b = os.date('*t',os.time())
local timeZone= (b.hour - a.hour) * 3600 + (b.min - a.min) * 60
print(timeZone/ 3600)
end
3万+

被折叠的 条评论
为什么被折叠?



