Sys2GetEpochTime

From EDM2
(Redirected from RxUtilEx - Sys2GetEpochTime)
Jump to: navigation, search

Converts formatted date and time into a number of seconds (UTC) from the epoch (defined as 1970-01-01 0:00:00). The input time is assumed to refer to the current timezone as defined in the TZ environment variable.

If no parameters are specified, the current system time is used. If at least one parameter is specified, then any missing parameter is assumed to be its minimum possible value (1 for day or month, 0 for all others).

The time is formatted according to the C runtime's locale support, as configured via the LANG and LC_* environment variables.

NOTE
Any date prior to 1 January 1970, or later than 19 January 2038, cannot be supported due to the limitations in how the C library calculates epoch time. Specifying any date before 1970 will generate a REXX error. Any time/date later than 12:14:07 on 19 January 2038 will return the latter value.

Arguments

  1. The year (1970-2037)
    A 2-digit year can be specified, in which case the number will be added to 1900 if it is 70 or higher, or to 2000 otherwise.
    e.g. '20' ==> 2020
    '75' ==> 1975 (This is subject to the limitation noted above.)
  2. The month (1-12)
  3. The day (1-31)
  4. Hours (0-23)
  5. Minutes (0-59)
  6. Seconds (0-61)

Return Value

The number of seconds since the epoch, or 0 on error.