ToInstant
The ToInstant
function casts date, date_time, offset_date_time, and zoned_date_time input parameters to the the instant data type. Instant stores time values as UTC Zulu time.
Syntax
ToInstant(date|date_time|offset_date_time|zoned_date_time) |
Return Type
instant
Details
Offset_date_time and zoned_date_time values with offset and/or timezone ids will be converted to UTC Zulu time. Instant stores only UTC Zulu values. Use the other data types if specific offset or timezone ids are needed.
If offset or timezone ids are unavailable in the input parameter, the function defaults the timestamp portion to ’00:00:00Z’.
Examples
select date1, ToInstant(date1), zoned_date_time_europe1, ToInstant(zoned_date_time_europe1) from AllTypes();
eval ToInstant(ToDate('2016-04-01','yyyy-MM-dd'));
select ToOffsetDateTime('September 22, 2016 Thursday 03:24:29 +03:00', 'MMMM dd, yyyy EEEE HH:mm:ss XXXXX') as zulu_plus_3_hours_example, ToInstant(ToOffsetDateTime('September 22, 2016 Thursday 03:24:29 +03:00', 'MMMM dd, yyyy EEEE HH:mm:ss XXXXX')) from Empty();