0

我有系统日期:

    04-JUN-14

我需要将其转换为日期时间:

    i.e.:   2014-06-04T01:00:02
    format: yyyy-mm-ddThh24:mi:ss

这是可行的吗?

4

1 回答 1

1

由于您的格式内部有一个小技巧T,因此您必须将其分成两部分:

with w as
(
  select sysdate d from dual
)
select to_char(w.d, 'yyyy-mm-dd') || 'T' || to_char(w.d, 'hh24:mi:ss')
from w;

编辑:更好的方法存在于一次调用中to_char,如另一个 SO 帖子所示:

select to_char(sysdate, 'yyyy-mm-dd"T"hh24:mi:ss') from dual;
于 2014-06-04T15:49:40.380 回答