-- 获取当前的格林尼治时间
print(os.time())
-- 获取当前时间的字符串表示,形如:11/28/08 10:28:37
print(os.date())
-- 获取当前日期的字符串表示,形如:11/28/08
print(os.date("%x", os.time()))
-- 获取当前时间的字符串表示,形如:10:28:37
print(os.date("%X", os.time()))
-- 获取当前时间的字符串表示,形如:10/10/13 10:28:37
print(os.date("%c", os.time()))
-- 获取当前时间的字符串表示,形如:2013-10-10 10:28:37
print(os.date("%Y-%m-%d %H:%M:%S", os.time()))
--函数os.clock返回执行该程序CPU花去的时钟秒数
local x1 = os.clock()
local s = 0
for i = 1, 10000000 do
s = s + i
end
local x2 = os.clock()
print(string.format("elapsed time: %.2f\n", x2 - x1))
local T2009_StartTime = { year=2013, month=2, day=9, hour=0, min=0, sec=0 }
local T2009_EndTime = { year=2013, month=2, day=17, hour=23, min=59, sec=59 }
T2009_AvtivityTime = { startTime = os.time(T2009_StartTime), endTime = os.time(T2009_EndTime) }
print(‘加载礼包活动成功,活动时间:‘ .. os.date(‘%c‘, T2009_AvtivityTime.startTime) ..
‘~‘ .. os.date(‘%c‘, T2009_AvtivityTime.endTime))
temp = os.date("*t", os.time())
print(temp)
--[[则会产生表
{year = 1998, month = 9, day = 16, yday = 259, wday = 4,
hour = 23, min = 48, sec = 10, isdst = false}
--]]