3
Date Timestamp Conversion in Lua
source link: https://fann.im/blog/2014/01/02/date-timestamp-conversion-in-lua/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Date Timestamp Conversion in Lua
Jan 2, 2014
Datetime to Timestamp
local dt = {year=2013, month=12, day=25, hour=0, min=0, sec=0}
print(os.time(dt))
-- 1387900800
Timestamp to Datetime
local ts = os.time()
print(os.date('%Y-%m-%d %H:%M:%S', ts))
-- 2013-12-25 22:09:51
More: Date and Time
Was this page helpful?
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK