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