oracle 时区问题

比如:
已知北京时间(2011-05-06 00:00:00),北京时区(+8),美国时区(-8)。
sql怎样获得美国的时间。

NEW_TIME 函数仅支持这几个
The arguments timezone1 and timezone2 can be any of these text strings:

[code="java"]AST, ADT: Atlantic Standard or Daylight Time

BST, BDT: Bering Standard or Daylight Time

CST, CDT: Central Standard or Daylight Time

EST, EDT: Eastern Standard or Daylight Time

GMT: Greenwich Mean Time

HST, HDT: Alaska-Hawaii Standard Time or Daylight Time.

MST, MDT: Mountain Standard or Daylight Time

NST: Newfoundland Standard Time

PST, PDT: Pacific Standard or Daylight Time

YST, YDT: Yukon Standard or Daylight Time
[/code]
也就是你自己列出的那几个

要功能更强大的,应该是这个
FROM_TZ

SELECT FROM_TZ(TIMESTAMP '2000-03-28 08:00:00', '3:00')
FROM DUAL;

FROM_TZ(TIMESTAMP'2000-03-2808:00:00','3:00')

帮你找了下这个,应该有所帮助
[quote]Oracle 中的from_tz函数,可以将一个timstamp和timzone拼成一个timestamp with timezone
Sql代码
SQL> select from_tz(to_timestamp('20090102','YYYYMMDD'), 'America/Sao_Paulo') from dual;

FROM_TZ(TO_TIMESTAMP('20090102

02-1月 -09 12.00.00.000000000 上午 AMERICA/SAO_PAULO

但如果这个timestamp在指定的时区内不存在(比如由于夏令时,时钟往前拨了一个小时),就会抛Exception
Sql代码
SQL> select from_tz(to_timestamp('20091101','YYYYMMDD'), 'America/Sao_Paulo') from dual;

select from_tz(to_timestamp('20091101','YYYYMMDD'), 'America/Sao_Paulo') from dual

ORA-01878: 在日期时间或间隔中没有找到指定的字段

解决办法嘛,先取出时区的offset,用其构建好timestamp with timezone后再转回指定的时区就好了
Sql代码
SQL> select from_tz(to_timestamp('20091101','YYYYMMDD'), tz_offset('America/Sao_Paulo')) at TIME ZONE 'America/Sao_Paulo' from dual;

FROM_TZ(TO_TIMESTAMP('20091101

31-10月-09 11.00.00.000000000 下午 AMERICA/SAO_PAULO

[/quote]

NEW_TIME(date,'this','that')
给出在this时区=other时区的日期和时间
SQL> select to_char(sysdate,'yyyy.mm.dd hh24:mi:ss') bj_time,to_char(new_time(sysdate,'PDT','GMT'),'yyyy.mm.dd hh24:mi:ss') los_angles from dual;

[code="sql"]SELECT * FROM V$TIMEZONE_NAMES[/code]