Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Converting Numbers to Dates

Re: Converting Numbers to Dates

From: <Solomon.Yakobson_at_entex.com>
Date: 1997/03/11
Message-ID: <858104005.11917@dejanews.com>#1/1

Simply do TO_DATE('1/1/1970','mm/dd/yyyy') + seconds/86400 where 86400 is number of seconds in one day:

  SELECT TO_CHAR(TO_DATE('1/1/1970','mm/dd/yyyy') +

                 Seconds/86400,
                 'mm/dd/yyyy hh:mi:sspm'
                )

    FROM TabA;

i.e. if Seconds = 844327462, the above statements returns

     10/03/1996 07:24:22am

Solomon.Yakobson_at_entex.com

In article <33254A1B.288C_at_citicorp.com>,   andy.smith_at_citicorp.com wrote:
>
> --
> I have a column in a table that stores the number of seconds
> since 1970, as a number ( datatype NUMBER )
>
> e.g
>
> taba
>
> col1 Null Type
> ---- ---- ----
> seconds NUMBER(15)
>
> select * from taba;
>
> seconds
> -------
> 844275235
> 844327462 etc.
>
> How can I convert this to a date e.g 11-MAR-1997
>
> Appreciate any comments.
>
> Regards

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet
Received on Tue Mar 11 1997 - 00:00:00 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US