I have for eg : 2022-01-20 03:59:00.000 -0600
I wish to apply the offset to the entire timestamp. How do I do it in Snowflake. I my case, 6 hrs should be subtracted here to get the time in CST (without the offset)
CodePudding user response:
Use CONVERT_TIMEZONE function:
SELECT CONVERT_TIMEZONE('Zulu', '2022-01-20 03:59:00.000 -0600'::timestamp_tz);
If you want truncate the timezone part, you can convert TZ timestamp to NTZ timestamp using TO_TIMESTAMP_NTZ function:
SELECT TO_TIMESTAMP_NTZ(CONVERT_TIMEZONE('Zulu', '2022-01-20 03:59:00.000 -0600'::timestamp_tz));