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: HELP - utc date problem

Re: HELP - utc date problem

From: Jonathan Lewis <jonathan_at_jlcomp.demon.co.uk>
Date: Wed, 30 Aug 2000 08:06:11 +0100
Message-ID: <967619811.25123.0.nnrp-09.9e984b29@news.demon.co.uk>

Something along the lines of the following should do - convert seconds to number of days then add to 1st Jan 1970.

select

    to_char(

        to_date('01-Jan-1970','dd-mon-yyyy') + {utc_value_goes_here}/(60*60*24) ,

        'dd-mon-yyyy hh24:mi:ss'
    )
from dual;

The to_char() is there only to allow you to see the time component which isn't displayed by default in SQL.

--

Jonathan Lewis
Yet another Oracle-related web site:  http://www.jlcomp.demon.co.uk

kal121_at_my-deja.com wrote in message <8ohi6s$jea$1_at_nnrp1.deja.com>...

>Here's the deal. I am receiving a date as a utc (universal time code)
>value from an application. The utc is the number of seconds elapsed
>since Jan. 1, 1970 at midnight. This number takes into account leap
>years.
>
>How can I convert the utc back to a normal date, such as "29-aug-2000
>02:30:35" accurately? It is not enough to simply divide the utc by
>24/60/60 as this does not take into account leap years and it is wrong.
>
>I don't see any oracle-provided date conversion packages for doing this.
>
>Any suggestions?
>
>Thanks
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
Received on Wed Aug 30 2000 - 02:06:11 CDT

Original text of this message

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