Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.server -> Re: correct to_date function question
On Wed, 07 Nov 2001 18:10:07 GMT, Mark Styles <news_at_lambic.co.uk>
wrote:
>On Wed, 7 Nov 2001 12:05:53 -0600, "SG" <sajnish_gupta_at_yahoo.com>
>wrote:
>
>>Thanks for your replies, but sorry, I messed up my earlier question. I am
>>trying to convert the UNIX date (in seconds since 1970) to date:
>>
>>SQL> select to_date((to_date('01-JAN-1970','DD-MON-YYYY') + 11417329.3))
>>from dual;
>
>should be:
>
>SELECT TO_DATE('01-JAN-1970','DD-MON-YYYY') + 11417329.3 FROM DUAL;
>
>Adding a number to a date returns a date by default.
>
>However, this is adding 11 million days to your date, which is rather
>a lot. There have only been around 11000 days since 1970.
>
So
SELECT TO_DATE('01-JAN-1970','DD-MON-YYYY') + 1/11417329.3 FROM DUAL; B. Received on Wed Nov 07 2001 - 13:02:07 CST
![]() |
![]() |