1. 程式人生 > >lua 時間戳和時間互相轉換

lua 時間戳和時間互相轉換

min time word minute times hour space cti code

1、時間戳轉換成時間

local t = 1412753621000

function getTimeStamp(t) return os.date("%Y%m%d%H",t/1000) end print(getTimeStamp(t)) 2、得時間戳 os.time() -- 當前時間戳
os.time({day=17, month=5, year=2012, hour=0, minute=0, second=0}) -- 指定時間的時間戳

lua 時間戳和時間互相轉換