Search code examples
sqloracle11gunix-timestamp

How to convert Epoch time to date?


Hi I have a column with number datatype the data like 1310112000 this is a date, but I don't know how to make it in an understandable format: ex: 10-mar-2013 12:00:00 pm

Can any one please help me.


Solution

  • That is EPOCH time: number of seconds since Epoch(1970-01-01). Use this:

    SELECT CAST(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 ) * '1310112003' AS TIMESTAMP) FROM DUAL;
    

    Result:

    08-JUL-11 08.00.03.000000000 AM