Oracle PL/SQL/Date Timezone/NEW TIME — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 10:01, 26 мая 2010
NEW_TIME(): Converting a Datetime from One Time Zone to Another
SQL>
SQL> --NEW_TIME(): Converting a Datetime from One Time Zone to Another
SQL>
SQL> SELECT TO_CHAR(NEW_TIME(TO_DATE("25-MAY-2006 19:45", "DD-MON-YYYY HH24:MI"), "PST", "EST"), "DD-MON-YYYY HH24:MI") FROM dual;
TO_CHAR(NEW_TIME(
-----------------
25-MAY-2006 22:45
SQL>
NEW_TIME() returns the <zone_two> equivalent of the <zone_one> date.
SQL>
SQL>
Syntax: NEW_TIME(<date>, <zone_one>,<zone_two>)
SQL>
SQL> SELECT
2 NEW_TIME(SYSDATE, "PST","AST") ast_time,
3 SYSDATE pst_time
4 FROM dual;
AST_TIME PST_TIME
--------- ---------
21-JUN-08 20-JUN-08
SQL>
Time Change from Chicago to Los Angeles
SQL> SELECT TO_CHAR(NEW_TIME(TO_DATE("060299 01:00:00 AM",
2 "MMDDYY HH:MI:SS AM"),
3 "CDT","PDT"), "DD-MON-YY HH:MI:SS AM") "Central to Pacific"
4 from DUAL;
Central to Pacific
---------------------
01-JUN-99 11:00:00 PM
1 row selected.
SQL>
SQL> --