Oracle Date/Time Function - Oracle/PLSQL NEW_TIME Function






NEW_TIME(x,time_zone1,time_zone2) converts x from time_zone1 to time_zone2.

Syntax

The syntax for the new_time function is:

new_time( date, zone1, zone2 )
zone1 and zone2 ValueDescription
ASTAtlantic Standard Time
ADTAtlantic Daylight Time
BSTBering Standard Time
BDTBering Daylight Time
CSTCentral Standard Time
CDTCentral Daylight Time
ESTEastern Standard Time
EDTEastern Daylight Time
GMTGreenwich Mean Time
HSTAlaska-Hawaii Standard Time
HDTAlaska-Hawaii Daylight Time
MSTMountain Standard Time
MDTMountain Daylight Time
NSTNewfoundland Standard Time
PSTPacific Standard Time
PDTPacific Daylight Time
YSTYukon Standard Time
YDTYukon Daylight Time




Example

The following query uses NEW_TIME() to convert date from PST to EST:


SQL> SELECT TO_CHAR(NEW_TIME(TO_DATE('25-MAY-2011 21:45',
  2  'DD-MON-YYYY HH24:MI'), 'PST', 'EST'), 'DD-MON-YYYY HH24:MI')
  3  FROM dual;

TO_CHAR(NEW_TIME(
-----------------
26-MAY-2011 00:45

SQL>