Convert a string date into datetime in Oracle

前端 未结 3 1289
独厮守ぢ
独厮守ぢ 2020-12-01 10:56

How can I convert this string date to datetime in oracle.

2011-07-28T23:54:14Z

Using this code throws an error:

TO_DATE(\'2         


        
相关标签:
3条回答
  • 2020-12-01 11:17

    Try this: TO_DATE('2011-07-28T23:54:14Z', 'YYYY-MM-DD"T"HH24:MI:SS"Z"')

    0 讨论(0)
  • 2020-12-01 11:18

    You can use a cast to char to see the date results

     select to_char(to_date('17-MAR-17 06.04.54','dd-MON-yy hh24:mi:ss'), 'mm/dd/yyyy hh24:mi:ss') from dual;

    0 讨论(0)
  • 2020-12-01 11:32

    Hey I had the same problem. I tried to convert '2017-02-20 12:15:32' varchar to a date with TO_DATE('2017-02-20 12:15:32','YYYY-MM-DD HH24:MI:SS') and all I received was 2017-02-20 the time disappeared

    My solution was to use TO_TIMESTAMP('2017-02-20 12:15:32','YYYY-MM-DD HH24:MI:SS') now the time doesn't disappear.

    0 讨论(0)
提交回复
热议问题