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: Jurij Modic <jurij.modic_at_mf.sigov.mail.si>
Date: 1997/03/11
Message-ID: <33256D2D.4CB@mf.sigov.mail.si>#1/1

Andy Smith wrote:
>
> --
> I have a column in a table that stores the number of seconds
> since 1970, as a number ( datatype NUMBER )
>
> seconds
> -------
> 844275235
> 844327462 etc.
>
> How can I convert this to a date e.g 11-MAR-1997

Example in SQL*Plus:

SQL> SELECT TO_DATE('01-JAN-70') + 844327462/(60*60*24) FROM DUAL; TO_DATE('



03-OCT-96 In Oracle's basic date arithmetics (adding, subtracting dates) the basic unit is 1 day, so fractions of 1 represents corresponding fractions of one day. So you simply convert your number of seconds to decimal number of days and add this number to your starting date.

Regards, Jure

-- 
 ===============================================================
 ! Jurij Modic                            Republic of Slovenia !
 !  tel: +386 61 178 55 14                Ministry of Finance  !
 !  fax: +386 61  21 45 84                Zupanciceva 3        !
 !  e-mail: jurij.modic_at_mf.sigov.mail.si  Ljubljana 1000       !
 ===============================================================
Received on Tue Mar 11 1997 - 00:00:00 CST

Original text of this message

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