How to convert quot;1985-02-07T00:00:00.000Zquot; (ISO8601) to a date value in Oracle?(如何转换“1985-02-07T00:00:00.000Z(ISO8601) 到 Oracle 中的日期值?)
问题描述
我尝试将时间戳 ("1985-02-07T00:00:00.000Z") 转换为日期,但我多次尝试均未成功.
I tried to convert a time-stamp ("1985-02-07T00:00:00.000Z") to a date and I failed to succeed in my several different attempts.
以下是我尝试过的查询:
Below is the query I have tried:
select to_date('1985-02-07T00:00:00.000Z', 'YYYY-MM-DDTHH24:MI:SS.fffZ')
from dual;
非常感谢您的建议.
推荐答案
to_date 将输入转换为不支持小数秒的 DATE 类型.要使用小数秒,您需要使用在使用 to_timestamp
to_date converts the input to a DATE type which does not support fractional seconds. To use fractional seconds you need to use a TIMESTAMP type which is created when using to_timestamp
pst 关于 ff3 修饰符的评论也是正确的.
pst's comment about the ff3 modifier is also correct.
格式掩码中的常量"值需要用双引号括起来
"Constant" values in the format mask need to be enclosed in double quote
所以最后的陈述是:
select to_timestamp('1985-02-07T00:00:00.000Z', 'YYYY-MM-DD"T"HH24:MI:SS.ff3"Z"')
from dual;
这篇关于如何转换“1985-02-07T00:00:00.000Z"(ISO8601) 到 Oracle 中的日期值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何转换“1985-02-07T00:00:00.000Z"(ISO8601) 到 Oracle 中的日期值?
基础教程推荐
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01
- 带更新的 sqlite CTE 2022-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
