Type Function Library os.* Return value Number Revision Release 2022.3683 Keywords os, time, date See also os.date() os.clock() system.getTimer()
Returns the current time in seconds from 1970 when called without arguments, or a time representing the date and time specified by the given table.
os.time( table )
local t = os.date( '*t' ) -- get table of current date and time print( os.time( t ) ) -- print date & time as number of seconds -- OUTPUT: 1287516614 t.min = t.min + 1 -- add one to the minute field print( os.time( t ) ) -- print number of seconds (increases by 60 seconds) -- OUTPUT: 1287516674 -- Get the number of seconds since Jan 1, 1970 for a specific date and time local t = {} t.year = 2018 t.month = 12 t.day = 25 t.hour = 0 t.min = 0 t.sec = 0 print( os.time( t ) ) -- OUTPUT: 1545714000