I am trying to convert a column that contains UTC values to EST values.

LOAD_DATE_UTC
2022-03-23 20:59:51.000

Expected output:

LOAD_DATE_UTC LOAD_DATE_EST
2022-03-23 20:59:51.000 2022-03-23 16:59:51.000

Approach tried:

SELECT LOAD_DATE_UTC, CAST(LOAD_DATE_UTC AS TIMESTAMP_LTZ(9)) AS LOAD_DATE_EST FROM TABLE_A 

The above approach seem to be returning the same value as is. Please advise how I can convert the column to EST values which is set as Local Time Zone at Snowflake configuration level

2 Answers

I believe the idea is to convert to EST (target)- So following approach will suit: CONVERT_TIMEZONE( <source_tz> , <target_tz> , <source_timestamp_ntz> )

SELECT LOAD_DATE_UTC, CONVERT_TIMEZONE(LOAD_DATE_UTC,'America/New_York',LOAD_DATE_UTC::timestamp_ntz) FROM TABLE_A 

7

try using convert_timezone.

select '2022-03-23 20:59:51.000' as EST, convert_timezone('UTC', '2022-03-23 20:59:51.000') as utc_time_zone; 
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy