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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Convert number to date in Oracle

Re: Convert number to date in Oracle

From: Isa <isapmon_at_terra.es>
Date: 13 Feb 2006 04:37:22 -0800
Message-ID: <1139834242.513087.297820@z14g2000cwz.googlegroups.com>


Hi,
If I have understood ok your question, for example: the date 01-jan-1970 00:00:45, in your database, it will be stored with the number: 45, not?
And , another example: the date 03-jan-1970 02:23:34, in your database, it will be stored with the number: 181414 , not?

Then, if you field is called date_seconds, for example, the select you must do is:

select
to_char( to_date('01-jan-1970 00:00:00','dd-mon-yyyy hh24:mi:ss') + date_seconds/86400,

            'dd-mon-yyyy hh24:mi:ss')
from table

The examples:
select
to_char( to_date('01-jan-1970 00:00:00','dd-mon-yyyy hh24:mi:ss')
+ 45/(86400),'dd-mon-yyyy hh24:mi:ss')

from dual
TO_CHAR(TO_DATE('01-



01-jan-1970 00:00:45

And the other example:
select
to_char( to_date('01-jan-1970 00:00:00','dd-mon-yyyy hh24:mi:ss')
+ 181414 /(86400),'dd-mon-yyyy hh24:mi:ss')
from dual
TO_CHAR(TO_DATE('01-



03-jan-1970 02:23:34

I hope it's useful to you, and if it's works fine and you want I explain you the select, tell me.
Regards,
Isa Received on Mon Feb 13 2006 - 06:37:22 CST

Original text of this message

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