Oracle conversion of UNIX timestamp to timestamp with time zone

前端 未结 1 1975
太阳男子
太阳男子 2021-01-27 11:00

Trying to convert UNIX timestamp to Oracle timestamp with timezone. Expecting to see different output, however datetime part is the same.

What is wring ?



        
相关标签:
1条回答
  • 2021-01-27 11:30

    Unix timestamp is from 1970-01-01 00:00:00 UTC. When you just do timestamp '1970-01-01 00:00:00' Oracle takes your local time zone!

    You have to do it like this:

    (TIMESTAMP '1970-01-01 00:00:00' AT TIME ZONE 'UTC' +     
        numtodsinterval(1204104116656/1000,'second')) AT time zone tz_offset('PST');
    

    `

    0 讨论(0)
提交回复
热议问题