Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> TO_TIMESTAMP_TZ and unix timestamps
I have a table with a column filled with unix timestamps (how many
seconds from whatever 1970) When people access that field it is not
taking into account daylight saving time. Originally I was tasked with
writing a huge case statement that would subtract an hour based on the
time of year. I did a little digging and found the TO_TIMESTAMP_TZ
function and read that it will handle all daylight saving time
adjustments. So i set my timezone and restarted the db.
SQL> select dbtimezone from dual;
DBTI
SQL>SELECT TO_TIMESTAMP_TZ('01/01/1970 00:00:00 EST', 'mm/dd/yyyy
HH24:MI:SS TZD')
+ ((1112390687 / 86400) - (18000/86400))
FROM dual;
TO_TIMESTAMP_TZ('01/
SQL>SELECT TO_TIMESTAMP_TZ('01/01/1970 00:00:00 EST', 'mm/dd/yyyy
HH24:MI:SS TZD')
+ ((1112649887/86400) - (18000/86400)) FROM dual;
TO_TIMESTAMP_TZ('01/
--SM Received on Wed Jan 26 2005 - 11:52:56 CST
![]() |
![]() |