oracle to_date conversion showing literal does not match string format

后端 未结 2 1202
深忆病人
深忆病人 2021-01-25 21:41

If I use a converter for unixtime I get

Tue, 31 May 2005 16:23:17 GMT for 1117556597. If I run the below query, I get the error literal does not match string format. Wh

2条回答
  •  花落未央
    2021-01-25 22:20

    TO_DATE method tries to match the input with the provided pattern. For ex:

    TO_DATE('2003/07/09', 'yyyy/mm/dd')
    TO_DATE('070903', 'MMDDYY')
    TO_DATE('20020315', 'yyyymmdd')
    

    you can check http://docs.oracle.com/cd/B19306_01/server.102/b14200/functions183.htm

    I guess this will help you (haven't tested)

    SELECT TO_CHAR(TO_DATE('01-JAN-1970','DD-MON-YYYY HH24:MI:SS') + 
    ( 1117556597/ (1000*60 * 60 * 24) ),'DD-MON-YYYY HH24:MI:SS') "DATE" FROM DUAL ;
    

提交回复
热议问题