Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Epoch Date conversion headache with BST

701695May 15 2009 — edited May 22 2009
Hi all,

Any help would be great as I’m going round in circles with epoch to oracle date conversions with timezones. After looking at previous topics I've had a go but just can't seem to get there!
I’ve set the time zone to Europe/London and when I query the CURRENT_TIMESTAMP it is correct as has accounted for British Summer time (GMT + 1)
However I’m struggling to convert an epoch date to a readable date that includes the BST adjustment. Can anyone have a look at my efforts below and see where I’m going wrong and maybe stop me going completely mad.
Thanks

ALTER database SET TIME_ZONE = 'Europe/London';
ALTER database SET succeeded.

select CURRENT_TIMESTAMP from dual;
CURRENT_TIMESTAMP
-----------------
15-MAY-09 10.40.16.927000000 EUROPE/LONDON (This is the correct time and includes the BST adjusted time of GMT +1 )

But I’m stuggling to be able to convert a raw epoch date and display it as a normal date.

Eg epoch date = 1241132400000 is 1st May 2009 0:00 but when I do the following I get an hour earlier

select to_timestamp_tz('1970-01-01 Europe/London', 'yyyy-mm-dd tzr')+
numtodsinterval(1241132400000/1000,'second') dstamp
from dual;

DSTAMP
-------------
30-APR-09 23.00.00.000000000 EUROPE/LONDON

But I’d like to see the BST date/time of 01-May-09 0:00

Any ideas? Sorry for this being so long!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 19 2009
Added on May 15 2009
18 comments
3,692 views