oracle数据库存储日期偏移列,用于将UTC日期转换为CST。然后当你选择SELECT时你会这样做:
select ConnectedDatetimeUTC, CAST(connecteddatetimeutc + (startdtoffset/ (24 * 60 * 60)) as timestamp(3)) as connecteddattimeManual2 from table1
我们正在努力在HIVE SQL中实现这一点。
答案 0 :(得分:0)
with table1 as
(
select timestamp '2017-02-28 23:58:41' as connecteddatetimeutc
,1234 as startdtoffset
)
select ConnectedDatetimeUTC
,startdtoffset
,from_unixtime (unix_timestamp(connecteddatetimeutc) + startdtoffset) as connecteddattimeManual2
from table1
;
+----------------------+---------------+-------------------------+
| connecteddatetimeutc | startdtoffset | connecteddattimemanual2 |
+----------------------+---------------+-------------------------+
| 2017-02-28 23:58:41 | 1234 | 2017-03-01 00:19:15 |
+----------------------+---------------+-------------------------+