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!

new_time( date, zone1, zone2 ) to convert datetime zones

SadockJul 8 2011 — edited Jul 8 2011
Dear all

I want to convert the datetime '07-JUL-2011 20:00' from 'Africa/Nairobi' time zone to 'Europe/London' time zone. However the following query throw back error ORA-01857: not a valid time zone

SQL> select to_char(new_time(to_date('07-JUL-2011 20:00', 'DD-MON-YYYY HH24:MI'), 'Africa/Nairobi', 'Europe/London'), 'DD-MON-YYYY HH24:MI') from dual;

I tried to guery 'V$TIMEZONE_NAMES' to get the abbreviation for 'Africa/Nairobi' and 'Europe/London' timeze so that i can use in place of zone1, and zone2 as follow but still it throw the same error

select *from V$TIMEZONE_NAMES where tzname in ('Africa/Nairobi', 'Europe/London');

Africa/Nairobi LMT
Africa/Nairobi EAT
Africa/Nairobi BEAT
Africa/Nairobi BEAUT
Europe/London LMT
Europe/London GMT
Europe/London BST
Europe/London BDST

SQL>select to_char(new_time(to_date('07-JUL-2011 20:00', 'DD-MON-YYYY HH24:MI'), 'EAT', 'GMT'), 'DD-MON-YYYY HH24:MI') from dual;

ORA-01857: not a valid time zone

My question is,what is the correct parameter to pass in zone1 and zone2 for each time zone location such as 'Africa/Nairobi', and 'Europe/London' to convert the time zone?

I wonder why this one is working?

SQL> select to_char(new_time(to_date('07-JUL-2011 20:00', 'DD-MON-YYYY HH24:MI'), 'EST', 'PST'), 'DD-MON-YYYY HH24:MI') from dual;

TO_CHAR(NEW_TIME(
-----------------
07-JUL-2011 17:00

Please any one for help

Regard
sadock
This post has been answered by 647939 on Jul 8 2011
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 5 2011
Added on Jul 8 2011
3 comments
1,766 views