Oracle 时区(TimeZone ) -- 时区转换

不同时区的查询

select n.tzname, n.tzabbrev, tz_offset(n.tzname) from v$timezone_names n;


不同时区的转换方法

时区转换的语法 at time zone

select systimestamp, systimestamp at time zone sessiontimezone from dual;

select from_tz(to_timestamp('2008/03/28 16:00:00'), '+08:00') at time zone '-07:00' from dual;

select to_timestamp_tz('2008/03/28 16:00:00 +08:00') at time zone 'US/Mountain' from dual;

-- 如果仅仅转换到UTC (GMt),使用 sys_extract_utc
 select systimestamp,
       sys_extract_utc(systimestamp) utc,
       (to_timestamp_tz(to_char(systimestamp)) at time zone '00:00') manually_utc
  from dual;

posted on 2012-02-10 14:58  wait4friend  阅读(2554)  评论(0编辑  收藏  举报