Type Function
Library os.*
Return value Number
Revision Current Public Release (2015.2646)
Keywords os, time, date
See also os.date()


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 )
table (optional)

Table. table specifying a time to convert to seconds. If table is present, it must have fields year, month, and day, and may have additional fields hour, min, sec, and isdst (for a description of these fields, see the os.date function).


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