Definition:
The Oracle PL/SQL NEW_TIME function converts a datetime value in a timezone to a datetime equivalent in another timezone. It accepts date input, current timezone and target timezone as its parameters.
Example Syntax:
NEW_TIME(date, timezone 1, timezone 2)
Timezone 2 is the current timezone of input Date. The function returns its equivalent in timezone 1. Note that NLS_DATE_FORMAT parameter must be set in the 24 hour time format before using the NEW_TIME function.
Example Usage:
The SQL example below returns the PST timezone equivalent of date in the EST timezone.
SELECT NEW_TIME(TO_DATE('12-14-10 12:26:34', 'MM-DD-YY HH24:MI:SS'),'PST', 'EST') "Time in PST"
FROM DUAL
/
Time in PST
--------------------
14-DEC-2010 15:26:34
Related Links:
Related Code Snippets: