Home Contents | # datetime:toTime_t | Date/Time | Core4 Lua Commands

## SYNOPSIS

1. tl, th = datetime:toTime_t()
2. datetime:setTime_t(tl, th)

## DESCRIPTION

Functions for converting a date/time to and from seconds since 1970-01-01 00:00:00.

Be aware that 32-bit integers will overflow somewhere in the year 2038. To help averting this, these functions will handle the value as two 32-bit values. tl holds the lower 32-bit while th holds the upper 32-bit.

## RETURN VALUE

datetime:toTime_t() returns the number of seconds since 1970-01-01 00:00:00 as a 64-bit value, split into two 32-bit values.

datetime:setTime() returns nothing.

## ERRORS

For datetime:setTime(), passing a value for th is mandatory. Trying to pass only tl will raise an error.

## SEE ALSO

clock.currentDateTime, clock.newDateTime, clock.setDateTime, clock.tzget, clock.tzset, datetime(), datetime:addDays, datetime:addMonths, datetime:addSecs, datetime:addYears, datetime:base90, datetime:date, datetime:day, datetime:daysTo, datetime:format, datetime:hour, datetime:isNull, datetime:isValid, datetime:isdst, datetime:minute, datetime:month, datetime:msec, datetime:offset, datetime:second, datetime:secsTo, datetime:set, datetime:setBase90, datetime:time, datetime:toLocal, datetime:toUTC, datetime:year, datetime:zone, tostring(datetime)