ToOffsetTime
The ToOffsetTime
function converts the input parameter to the offset_time data type.
Syntax
ToOffsetTime(<string>|<date_time>|<offset_date_time>|<zoned_date_time> [, <format_mask>] ) |
The optional format parameter defines the date time formatting mask to use when converting a string to time. Refer to https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html for information regarding the allowed formatting masks.
Return Type
offset_time
Details
The function returns null if the input parameter cannot be converted to an offset_time value. Any year, month, or day information is lost when converting to the offset_time data type.
The offset_time retains timezone offset information (but not timezone name or id). Refer to the below examples.
Examples
select Now(), ToOffsetTime(Now()) from Empty();
eval ToOffsetTime('23:59:59.999Z', 'HH:mm:ss.SSSX');
eval ToOffsetTime('05:40:38 -08:00', 'HH:mm:ss xxxxx');
eval ToOffsetTime('10:15:30+01:00[Europe/Paris]', 'HH:mm:ssXXXXX''[''zzz'']''');