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: Allen Kirby <akirby_at_att.com>
Date: 1997/03/11
Message-ID: <3325B777.19D4@att.com>#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 )
>
> 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

I won't ask why you didn't store it as a date value in the first place. Here's one way (there are others): Take the actual start date (Jan. 1 1970 00:00 e.g.) and add seconds/3600 (which is the number of days represented by that many seconds). This should work given the correct start date. You could also write a pro*c program but why bother if the above works.

-- 
---
Allen Kirby			AT&T ITS Production Services
akirby_at_att.com			Alpharetta, GA.
Received on Tue Mar 11 1997 - 00:00:00 CST

Original text of this message

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