开发者

Oracle: epoch date to date with CEST and CET

I got a date like this '1302104376' stored with the italian timezone UTC+1. I need to convert it into the format DD:MM:YYYY HH:SS, but with timezione UTC + 0 (GMT). Does exists a function that does the work, paying attention to the daylight p开发者_高级运维eriod ?

Thanks for your help Simone


This should get you close:

SQL> SELECT TO_CHAR(TO_DATE('19700101','YYYYMMDD') + 
                    (1302104376/(60*60*24)),'DD:MM:YYYY HH24:MI:SS') the_date 
       FROM dual;

THE_DATE
-------------------
06:04:2011 15:39:36

SQL> 

You'll need to adjust your output accordingly for differences in timezones, DST, etc.

This site is highly instructive regarding epoch dates.


You could build on the result from DCookie's answer and add a call to SYS_EXTRACT_UTC

http://psoug.org/snippet/TIMESTAMP-SYS_EXTRACT_UTC_616.htm

http://download.oracle.com/docs/cd/E14072_01/server.112/e10592/functions184.htm

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜