SWITCHOFFSET_UDF (TIMESTAMP_TZ, VARCHAR)

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_paristime_in_costa_rica

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

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

Last updated