SWITCHOFFSET_UDF (TIMESTAMP_TZ, VARCHAR)

Important Notice: Migration of Documentation Website

Please be advised that our documentation website is currently undergoing a migration to a new platform. To ensure you have access to the most up-to-date information, we kindly request that you visit our new documentation website located at:

Official Snowflake Snowconvert Documentation

For any immediate assistance or if you encounter any issues, please contact our support team at [email protected].

Thank you for your understanding.

Definition

This user-defined function (UDF) returns a new timestamp_tz with the adjusted time taken for parameter target_tz.

SWITCHOFFSET_UDF(source_timestamp TIMESTAMP_TZ, target_tz varchar)

Parameters

source_timestamp TIMESTAMP_TZ

The source timestamp to adjust.

target_tz varchar

The target time to take.

Returns

Returns the formatted target time as TIMESTAMP_TZ.

Usage example

Input:

SELECT SWITCHOFFSET_UDF(time_in_paris, '-0600') as time_in_costa_rica;

Output:

time_in_paris
time_in_costa_rica

2022-10-05 22:00:24.467 +02:00

2022-10-05 14:00:24.467 -06:00

Last updated