Oracle中的时区日期格式 [英] Timezone date format in Oracle
本文介绍了Oracle中的时区日期格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须将SYSDATE
日期转换为特定的日期格式.该格式必须是这样的:'2016-11-23T15:12:48Z'
.我认为这是一种奇怪的日期格式,但这是我的要求.
I have to convert a SYSDATE
date to a specific date format. That format must be something like this: '2016-11-23T15:12:48Z'
. I think this is a weird date format but is the requirements that I have.
这必须是发送Web服务消息的日期.
This must be a date to send in a Web Service message.
在Oracle(12c或11g)中,我有一些功能可以转换这种特定格式的日期?谢谢.
In Oracle (12c or 11g) I have some function to transform a date in this specific format? Thanks.
推荐答案
这将为您提供注释中提到的ISO-8601:
That will give you ISO-8601 mentioned in comment:
select to_char(systimestamp,'YYYY-MM-DD"T"hh24:mi:sstzh:tzm') isodt from dual;
如果您确实想要Z
而不是时区,则可以使用:
If you really want Z
instead of timezone you can use:
select to_char(cast(systimestamp as timestamp) at time zone 'UTC',
'yyyy-mm-dd"T"hh24:mi:ss"Z"')
from dual;
这篇关于Oracle中的时区日期格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文