Skip to main content

Description

Changes a datetime value’s time zone from the value’s original time zone to the time zone given in tz_string and returns the value.

Syntax

SwitchTimeZone(datetime_expression, tz_value)

Arguments

datetime_expression - datetime expression in original time zone. tz_value - string representing the target time zone. Use an IANA (tz database) region identifier in Area/City form, such as Europe/London, America/Chicago, or Asia/Tokyo. See the List of tz database time zones on Wikipedia for valid identifiers. SwitchTimeZone changes how the instant is displayed, not the instant itself.
Pick the region identifier for your location (for example, Europe/London) and let SwitchTimeZone handle the rest. Region identifiers adjust for daylight saving automatically using the tz database.Never pick a zone because its offset happens to match your clock today. A zone chosen by offset, or a different region that shares your current offset, will be wrong for part or all of the year. For example, Europe/Madrid sits at the same offset as Europe/London in summer but is permanently one hour ahead in winter.

Examples

SwitchTimeZone(ToDate('2014-11-01T23:30:00+02:00'),'America/Chicago') returns 2014-11-01T15:30:00-06:00 Daylight saving is applied automatically for the given region. In summer, Europe/London is one hour ahead of UTC: SwitchTimeZone(ToDate('2026-07-27T17:00:00Z'),'Europe/London') returns 2026-07-27T18:00:00+01:00 In winter, the same region is back at UTC+0: SwitchTimeZone(ToDate('2026-12-01T17:00:00Z'),'Europe/London') returns 2026-12-01T17:00:00Z To build a dynamic lookback value for a SQL WHERE clause, combine SwitchTimeZone with ToString. This gives the current London wall-clock time minus 60 minutes, formatted for the query: ToString(SwitchTimeZone(SubtractDuration(CurrentTime(), 'PT1H'), 'Europe/London'), 'yyyy-MM-dd HH:mm:ss')

Return value datatype

Datetime

Impact of null value

If datetime_value is null, returns null. If tz_value is null or invalid, an exception is raised.
Last modified on July 27, 2026