Re: GMT to Local Time conversion

From: Mike Morgan <mmorgan1_at_mail.tds.net>
Date: 1997/08/26
Message-ID: <01bcb1cb$5583a6e0$4906f6cc_at_madison.tdsnet.com>#1/1


Hugo,

The steps you need to take are:
1) Determine how many days are represented by the number of seconds : seconds/60/60/24
2) Add that number to the date 01-JAN-1970 : this will give you the GMT date

[Quoted] 3)	Use the NEW_TIME() function to convert GMT to local time
4)	Optionally, format result into date and time using TO_CHAR()

If you substitute <seconds> with your actual date/time value and <local_time_zone> with your time zone the following select statement should get you what you want.

select
to_char(new_time((to_date('01-jan-1970',dd-mon-yyyy')+(<seconds>/60/60/24)), 'gmt','<local_time_zone>'),'mm/dd/yyyy hh24:mi:ss') from dual;

Mike Morgan

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
[Quoted] Hugo Baake <hbbaake_at_pi.net> wrote in article <01bcb17c$ad51c6d0$05c809c0_at_nt4server1>...
> Hi!
>
> I've got a number representing date/time information, stored in seconds,
> based upon 01-JAN-1970. This number is in GMT.
> Can anybody tell me how I can convert this number (in PL/SQL or SQL*Plus)
> to the local time (corrected for timezone and daylight saving time, the
> same functionality as the localtime() function in C.)?
>
> Thanks in advance,
>
> Hugo.
>
>
Received on Tue Aug 26 1997 - 00:00:00 CEST

Original text of this message