CONVERT_TIMEZONE

Description

The CONVERT_TIMEZONE function in Amazon Redshift converts a timestamp from one time zone to another, where you specify the original time zone, the target time zone, and the timestamp to convert. Making it useful for managing time accurately across different regions

Grammar Syntax

CONVERT_TIMEZONE(source_timezone, target_timezone, timestamp)

Sample Source Patterns

Input Code:

IN -> Redshift_01.sql
SELECT
    GETDATE(),
    CONVERT_TIMEZONE('UTC', 'Europe/London', GETDATE()) AS london_time,
    CONVERT_TIMEZONE('UTC', 'Asia/Tokyo', GETDATE()) AS tokyo_time;

Output Code:

OUT -> Redshift_01.sql
SELECT
    GETDATE(),
    CONVERT_TIMEZONE('UTC', 'Europe/London', GETDATE()) AS london_time,
    CONVERT_TIMEZONE('UTC', 'Asia/Tokyo', GETDATE()) AS tokyo_time;

There are no known issues.

Last updated