Convert the datetime value of one time zone to another time zone in Vertica
Question
Is there anything in Vertica to get the same output as given by the following Sql query in Oracle?
SELECT FROM_TZ(CAST(TO_DATE('1999-12-01 11:00:00',
'YYYY-MM-DD HH:MI:SS') AS TIMESTAMP), 'America/New_York')
AT TIME ZONE 'America/Los_Angeles' "West Coast Time"
FROM DUAL;
West Coast Time
------------------------------------------------
01-DEC-99 08.00.00.000000 AM AMERICA/LOS_ANGELES
Solution
I was able to convert. Sample queries given below:
SELECT TIMESTAMP WITH TIME ZONE '2012-07-02 10:00:00-04' AT TIME ZONE 'GMT';
timezone
---------------------
2012-07-02 14:00:00
(1 row)
SELECT TIMESTAMP WITH TIME ZONE '2012-07-02 14:00:00-00' AT TIME ZONE 'EDT';
timezone
---------------------
2012-07-02 10:00:00
(1 row)
OTHER TIPS
Might be helpful .There is a function for this purpose in oracle
https://docs.oracle.com/cd/B28359_01/olap.111/b28126/dml_functions_2036.htm
select NEW_TIME (TO_DATE ('2011/11/11 01:45', 'yyyy/mm/dd HH24:MI'), 'AST', 'MST') from dual;
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow