首页 > 解决方案 > Convert Values with Timezone to timestamp

问题描述

I need to convert some values (in text format) to TIMESTAMP data type before loading to Oracle tables. The values are having Timezone info as in below samples:

2018-05-28T14:32:53.5860707+08:00

2018-05-30T08:26:47.554801+08:00

2018-05-21T16:26:29.5443257+08:00

Can you please help?

Thanks,

David

标签: sqloracletimestamp-with-timezone

解决方案


You want to use to_timestamp_tz with format string 'YYYY-MM-DD"T"HH24:MI:SS:FFTZH:TZM'. Put the "T" in quotes in the format string.

select 
   to_timestamp_tz('2018-05-28T14:32:53.5860707+08:00', 'YYYY-MM-DD"T"HH24:MI:SS:FFTZH:TZM')
from dual

推荐阅读