AT_TIME_ZONE

The date function used to convert a date or date time value to a given time zone. Takes two arguments, the date to be converted and the timezone. Time zones can be specified either via three-letter code ("UTC", "CST") or via offset ("-06:00"). If the date or datetime value has no specified time zone, this function simply applies the specified timezone to the specified time. If the date or datetime value already has a specified time zone, the specified time will be converted to the value of that time in the time zone parameter. Offsets should be specified with leading zero, i.e "-06:00", not "06:00".
Note also that some common three letter codes are not supported for use with AT_TIME_ZONE, as they are not standard. This includes timezone abbreviations for US daylight savings time, such as "EDT", "CDT", and "PDT". For such time zones, the easiest thing to do is use an offset explicitly.

ParameterType
dateValue
datetimestamp, datetime, date, time, gyear, gyearmonth
timezone
string
Returns: date

Example

query:

SELECT AT_TIME_ZONE(CAST("2018-01-02" AS DATE), "-06:00")

results:

at_time_zone
2018-01-02-06:00

query:

SELECT AT_TIME_ZONE(CAST("2018-01-02" AS DATE), "EST")

results:

at_time_zone
2018-01-02-05:00

query:

SELECT AT_TIME_ZONE(CAST("2018-01-02T10:41:26" AS DATETIME), "-06:00")

results:

at_time_zone
2018-01-02T10:41:26-06:00