简体   繁体   中英

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

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

从双重选择to_timestamp_tz('2018-05-28T14:32:53.5860707 + 08:00','YYYY-MM-DD“T”HH24:MI:SS:FFTZH:TZM')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM