WithZoneSameInstant
Use the WithZoneSameInstant
function to convert a date time value from one timezone to another.
Syntax
WithZoneSameInstant(<date>|<date_time>|<instant>|<offset_date_time>|<zoned_date_time> [,<string>]) |
The second string input parameter takes a Java zone_id or zone_name. Refer to Java docs for a list of valid values.
Return Type
zoned_date_time
Details
The function alters timestamp values when converting from one timezone to another.
Examples
select Now(), TypeNameOf(Now()), WithZoneSameInstant(Now(), 'America/Chicago'), TypeNameOf(WithZoneSameInstant(Now(), 'America/Chicago')) from Empty();
Select ToZonedDateTime('2016-10-19T14:11:07.790-05:00[America/Chicago]') as time_stamp_orig, WithZoneSameInstant(ToZonedDateTime('2016-10-19T14:11:07.790-05:00[America/Chicago]'), 'America/Denver') as time_stamp_changed from Empty();