Datetime:interval(from, [expressed])method
Returns an interval with the from Datetime value, expressed by default in days.
Parameters
from
A Datetime value from where the interval will be calculated, to the current Datetime value.
[expressed]
An optional string that indicates how the interval will be expressed (by default, in days). The following strings are accepted :
- "seconds"
- "minutes"
- "hours"
- "days"
- "months"
- "years"
Return value
Return a number as an interval, expressed in days by default.Example
-- get current date and time
local today = sys.Datetime()
-- prints only the current time, not the date
print("Current time = "..today:format(nil, "HH:mm:ss"))