Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将 XML Schema xs:dateTime 格式的日期转换为使用to_char.
to_char
我试过了:
select to_char('2013-08-16T09:55:02+02:00', 'dd-mm-yyyy hh:mm:ss') from dual;
但这失败了。
关于如何做到这一点的任何线索?
TO_TIMESTAMP_TZ()使用然后应用TO_CHAR()函数将字符串文字转换为具有时区数据类型的时间戳:
TO_TIMESTAMP_TZ()
TO_CHAR()
select to_char(to_timestamp_tz( '2013-08-16T09:55:02+02:00' , 'yyyy-mm-dd"T"hh:mi:ssx TZH:TZM' ) , 'dd-mm-yyyy hh:mi:ss') as res from dual
结果:
Res: ----------------- 16-08-2013 09:55:02