2017-03-09 1 views
1

오라클 데이터베이스는 UTC 날짜를 CST로 변환하는 데 사용되는 날짜 오프셋 열을 저장합니다. 그렇다면 SELECT를하면 다음과 같이됩니다 :하이브 - UTC에서 CSRT로 날짜의 수동 변환

 
    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  | 
+----------------------+---------------+-------------------------+ 
+0

알았다 선생님을 포함하여 작은 데이터 샘플을 추가하십시오! 내가 필요로 한 유일한 조정은 DECIMAL로 정의 되었기 때문에 상쇄에 대한 CAST였습니다. – JB11

+0

위대한 :-). 답을 수락하는 것을 잊지 마십시오. –

관련 문제