Skip to content
Advertisement

Conversion of time zone in snowflake sql

I am doing a conversion of timezone from current_timestamp to ‘US/Eastern’ in snowflake view. I was able to create the view but when I preview the data I am getting Timestamp ‘US/Eastern’ is not recognized error.

I am converting like below:

((CONVERT_TIMEZONE(current_timestamp, 'US/Eastern') - INTERVAL '5 HOUR'))

Advertisement

Answer

Thus looking at TIMEZONE doc‘s LukStorms points, and following the link to the Wikipedia List_of_tz_database_time_zones US/Eastern is the same as America/New_York, thus

But the 2 parameter version is in the form:

but you are doing ( <source_timestamp>, <target_tz>)

Also the - INTERVAL '5 HOUR' appears the same as “to UTC for the current not in Daylight savings time”, it would seem safer to use the complete version of CONVERT_TIMEZONE to do the to UTC part. it would seem you should use the form from the examples:

thus use :

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement