简体   繁体   中英

Oracle (SQL Developer): How to convert TIMESTAMP string includeing UTC Offset

Objective

Identify the correct TIMESTAMP format and the cause of the issue.

Problem

Tring to load a CSV which includes timestamp including UTC offset.

2014-01-01T00:38:51.000+11:00

The format string is below.

YYYY-MM-DD"T"HH24:MI:SS.FF3TZH:TZM

However, getting an error message.

Invalid format YYYY-MM-DD"T"HH24:MI:SS.FF3TZH:TZM is specified.

SQL Developer

TIMESTAMP

在此处输入图片说明

TIMESTAMP with TZ 在此处输入图片说明

Please suggest how to fix this and the reason.

References

Oracle 9: Convert date from mm/dd/yyyy hh:mm:ss format to iso8601 formatted datetime [closed]

There is nothing wrong with the timestamp with timezone format:

SQL> select to_timestamp_tz('2014-01-01T00:38:51.000+11:00',
  2       'YYYY-MM-DD"T"HH24:MI:SS.FF3TZH:TZM') as result from dual;

RESULT
---------------------------------------------------------------------------
01-JAN-14 12.38.51.000000000 AM +11:00

1 row selected.

Elapsed: 00:00:00.00

(What is DISPLAYED is in a different format - it uses my NLS_TIMESTAMP_TZ_FORMAT session parameter - but the conversion from string to timestamp with timezone worked perfectly fine.)

Definitely a SQL Developer issue - you will need to find out how this is done in their interface.

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