gsql_ts_to_epoch_seconds()
Converts a timestamp in canonical string format to Unix epoch time, which is the number of seconds since Jan 1, 1970 00:00.
In 4.2.1, two new timestamp conversion functions are available for loading jobs, offering different behaviors for date handling, especially for dates prior to 1970: gsql_ts_to_epoch_seconds_legacy() and gsql_ts_to_epoch_seconds_signed().
Parameters
- timestamp
 - 
Required. The timestamp to convert to Unix epoch time. The timestamp parameter should be in one of the following formats:
- 
"%Y-%m-%d %H:%M:%S" - 
"%Y/%m/%d %H:%M:%S" - 
"%Y-%m-%dT%H:%M:%S.000z"- 
Text after the dot
.is ignored 
 - 
 
 - 
 
Return type
UINT
- 
Returns the number of seconds since
1970-01-01 00:00:00for valid timestamps within the supported range. - 
Throws an exception if the timestamp is invalid or before
1970-01-01 00:00:00. 
Example
gsql_ts_to_epoch_seconds("2022-06-30 22-08-28") -> 1656652105
| Function | Return type | Supported Time Range | Response to Invalid/Unsupported Datetimes | Description | 
|---|---|---|---|---|
gsql_ts_to_epoch_seconds()  | 
  | 
  | 
Throws exception  | 
Converts a timestamp to Unix epoch time (from 1970 onwards).  | 
gsql_ts_to_epoch_seconds_legacy()  | 
  | 
  | 
Returns defaultTimestamp  | 
Similar to   | 
gsql_ts_to_epoch_seconds_signed()  | 
  | 
  | 
Returns defaultTimestamp  | 
Supports a full date range, including pre-1970 timestamps, and returns negative epoch values for those dates.  | 
| 
 If you need to avoid exceptions for invalid or pre-1970 dates, or require support for historical dates, consider using gsql_ts_to_epoch_seconds_legacy() or gsql_ts_to_epoch_seconds_signed().  |