【发布时间】:2015-02-06 01:25:43
【问题描述】:
Lua 5.1 文档说:
如果格式以 '!' 开头,则日期格式为 Coordinated 世界时。
如果格式是%c,! 的行为似乎是正确的
local date_1 = os.date("!%c")
local date_2 = os.date("%c")
print("utc date: "..date_1)
print("not utc date: "..date_2)
如果格式为*t,! 的行为似乎已交换
local time_1 = os.time(os.date("!*t"))
local time_2 = os.time(os.date("*t"))
print("should be utc time, but is not: "..time_1) -- this should be UTC, and is not
print("should not be utc time, but is: "..time_2) -- this should not be UTC, but is
测试日期:http://www.epochconverter.com/
为什么会这样?
【问题讨论】: