简体   繁体   English

Oracle(SQL Developer):如何转换包含UTC偏移量的TIMESTAMP字符串

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

Objective 目的

Identify the correct TIMESTAMP format and the cause of the issue. 确定正确的TIMESTAMP格式和问题的原因。

Problem 问题

Tring to load a CSV which includes timestamp including UTC offset. 尝试加载包含时间戳(包括UTC偏移量)的CSV。

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. 指定了无效的格式YYYY-MM-DD“ T” HH24:MI:SS.FF3TZH:TZM。

SQL Developer SQL开发人员

TIMESTAMP TIMESTAMP

在此处输入图片说明

TIMESTAMP with TZ 与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] Oracle 9:将日期从mm / dd / yyyy hh:mm:ss格式转换为iso8601格式的日期时间[关闭]

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.) (显示的内容格式不同-它使用了我的NLS_TIMESTAMP_TZ_FORMAT会话参数-但从字符串到带有时区的时间戳的转换效果很好。)

Definitely a SQL Developer issue - you will need to find out how this is done in their interface. 绝对是SQL Developer的问题-您将需要在他们的界面中查找如何完成此操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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