Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: HELP - utc date problem
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>...Received on Wed Aug 30 2000 - 02:06:11 CDT
>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.