在Vertica中将一个时区的日期时间值转换为另一个时区

时间:2012-06-30 02:38:10

标签: timezone vertica

Vertica中是否有任何内容可以获得与Oracle中以下Sql查询所给出的相同的输出?

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

2 个答案:

答案 0 :(得分:3)

我能够转换。下面给出的示例查询:

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)

答案 1 :(得分:0)

可能会有所帮助。在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;