- Categories:
CONVERT_ TIMEZONE¶
Converts a timestamp to another time zone.
Syntax¶
Arguments¶
source_tzString specifying the time zone for the input timestamp. Required for timestamps with no time zone (i.e. TIMESTAMP_NTZ).
target_tzString specifying the time zone to which the input timestamp is converted.
source_timestamp_ntzFor the 3-argument version, string specifying the timestamp to convert (must be TIMESTAMP_NTZ).
source_timestampFor the 2-argument version, string specifying the timestamp to convert (can be any timestamp variant, including TIMESTAMP_NTZ).
Returns¶
Returns a value of type TIMESTAMP_NTZ, TIMESTAMP_TZ, or NULL:
- For the 3-argument version, returns a value of type TIMESTAMP_NTZ.
- For the 2-argument version, returns a value of type TIMESTAMP_TZ.
- If any argument is NULL, returns NULL.
Usage notes¶
-
The display format for timestamps in the output is determined by the timestamp output format for the current session and the data type of the returned timestamp value.
-
For the 3-argument version, the “wallclock” time in the result represents the same moment in time as the input “wallclock” in the input time zone, but in the target time zone.
-
For the 2-argument version, the
source_timestampargument typically includes the time zone. If the value is of type TIMESTAMP_TZ, the time zone is taken from its value. Otherwise, the current session time zone is used. -
For
source_tzandtarget_tz, you can specify a time zone name or a link name from release 2025b of the IANA Time Zone Database (for example,America/Los_Angeles,Europe/London,UTC,Etc/GMT, and so on).Note
- Time zone names are case-sensitive and must be enclosed in single quotes (e.g.
'UTC'). - Snowflake does not support the majority of timezone abbreviations (e.g.
PDT,EST, etc.) because a given abbreviation might refer to one of several different time zones. For example,CSTmight refer to Central Standard Time in North America (UTC-6), Cuba Standard Time (UTC-5), and China Standard Time (UTC+8).
- Time zone names are case-sensitive and must be enclosed in single quotes (e.g.
Examples¶
To use the default timestamp output format for the timestamps returned in the examples, unset the TIMESTAMP_OUTPUT_FORMAT parameter in the current session:
Examples that specify a source time zone¶
The following examples use the 3-argument version of the CONVERT_TIMEZONE function and specify a source_tz
value. These examples return TIMESTAMP_NTZ values.
Convert a “wallclock” time in Los Angeles to the matching “wallclock” time in New York:
Convert a “wallclock” time in Warsaw to the matching “wallclock” time in UTC:
Examples that do not specify a source time zone¶
The following examples use the 2-argument version of the CONVERT_TIMEZONE function. These examples return
TIMESTAMP_TZ values. Therefore, the returned values include an offset that shows the difference between
the timestamp’s time zone and Coordinated Universal Time (UTC). For example, the America/Los_Angeles
time zone has an offset of -0700 to show that it is seven hours behind UTC.
Convert a string specifying a TIMESTAMP_TZ value to a different time zone:
Show the current “wallclock” time in different time zones: