[英]db date time with timezone in a specific format
I am trying to get db date and time using a sql query in the format like "2016-01-26T12:07:41-08:00" 我正在尝试使用SQL查询格式的数据库日期和时间,例如“ 2016-01-26T12:07:41-08:00”
the select systimestamp from dual gives me value like 2016-02-03 10:39:29.099545 -8:00 从双选择systimestamp给我像2016-02-03 10:39:29.099545 -8:00
so what should be the right query for it 那么什么是正确的查询
I think this is what you're after: 我认为这是您追求的目标:
select to_char(systimestamp, 'yyyy-mm-dd"T"hh24:mi:ssTZH:TZM') time_stamp
from dual;
TIME_STAMP
---------------------------------------------------
2016-02-04T12:20:33-05:00
I am not 100% on what your desired format is as you seem to give the same format twice. 我不是100%想要的格式,因为您似乎两次给出相同的格式。 However, if you want to change the format of systimestamp output you could do something like this: SELECT TO_CHAR(SYSTIMESTAMP, 'dd/mm/yy') FROM DUAL;
但是,如果要更改systimestamp输出的格式,可以执行以下操作:SELECT TO_CHAR(SYSTIMESTAMP,'dd / mm / yy')FROM DUAL;
Result: 04/02/16 结果:16/02/02
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.