Skip to main content

time

Function time 

Source
pub fn time(t: option<table>) -> number
Expand description

Returns the current time, or converts a date table to a time.

§Parameters

  • table: a table describing a local date, with mandatory fields year, month and day, and optional fields hour (default 12), min, sec (default 0) and isdst.

§Return value

A time value, whose meaning depends on the system — on POSIX and Windows, the number of seconds since the epoch. When called without arguments, the current time. The returned value can be used with date and difftime.

§Examples

print(os.time())    --> 1788806700
print(os.time({ year = 2026, month = 9, day = 3 }))
--> 1788782400

§See also

date, difftime, clock