Article View: comp.databases.oracle.misc
Article #142Re: GMT to Local Time conversion
From: Mike Morgan
Date: Tue, 26 Aug 1997 00:00
Date: Tue, 26 Aug 1997 00:00
37 lines
2125 bytes
2125 bytes
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
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
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Hugo Baake <hbbaake@pi.net> wrote in article
<01bcb17c$ad51c6d0$05c809c0@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.
>
>
Technical Details
Message-ID:
<01bcb1cb$5583a6e0$4906f6cc@madison.tdsnet.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<01bcb17c$ad51c6d0$05c809c0@nt4server1>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fb53f,fb10078410139223,start X-Google-Attributes: gidfb53f,public X-Google-Thread: fa4f9,fb10078410139223,start X-Google-Attributes: gidfa4f9,public X-Google-Thread: f99a8,fb10078410139223,start X-Google-Attributes: gidf99a8,public X-Google-Thread: 10747e,fb10078410139223,start X-Google-Attributes: gid10747e,public X-Google-Thread: f5464,fb10078410139223,start X-Google-Attributes: gidf5464,public From: "Mike Morgan" <mmorgan1@mail.tds.net> Subject: Re: GMT to Local Time conversion Date: 1997/08/26 Message-ID: <01bcb1cb$5583a6e0$4906f6cc@madison.tdsnet.com> X-Deja-AN: 268534834 References: <01bcb17c$ad51c6d0$05c809c0@nt4server1> Organization: TDS Telecom - Madison, WI Newsgroups: comp.databases.oracle.misc,comp.databases.oracle.server,comp.databases.oracle.tools,hannover.uni.comp.oracle,relcom.comp.dbms.oracle