AT TIME ZONE

Description

Converts an inputdate to the corresponding datetimeoffset value in the target time zone. (AT TIME ZONE in Transact-SQL).

Sample Source Pattern

Syntax

inputdate AT TIME ZONE timezone

Examples

IN -> SqlServer_01.sql
SELECT CAST('2022-11-24 11:00:45.2000000 +00:00' as datetimeoffset) at time zone 'Alaskan Standard Time';

Result:

                          DATE|
------------------------------+
2022-11-24 02:00:45.200 -09:00|

Code:

IN -> SqlServer_02.sql
SELECT current_timestamp at time zone 'Central America Standard Time';

Result:

                          DATE|
------------------------------+
2022-10-10 10:55:50.090 -06:00|

Known Issues

  1. Snowflake does not support all the time zones that SQL Server does. You can check the supported time zones at this link.

IN -> SqlServer_03.sql
SELECT current_timestamp at time zone 'Turks And Caicos Standard Time';

Result:

                          DATE|
------------------------------+
2022-12-14 20:04:18.317 -05:00| 

Last updated