Oracle / PLSQL: NEW_TIME Function
This Oracle tutorial explains how to use the Oracle/PLSQL NEW_TIME function with syntax and examples.
Description
The Oracle/PLSQL NEW_TIME function converts a date from time zone1 to a date in time zone2.
Syntax
The syntax for the NEW_TIME function in Oracle/PLSQL is:
NEW_TIME( date, zone1, zone2 )
Parameters or Arguments
- zone1
- Original time zone that date is currently displayed in. It can be a value from the table below.
- zone2
New time zone that you wish to display result. It can be one of the values in the following table:
Value Description AST Atlantic Standard Time ADT Atlantic Daylight Time BST Bering Standard Time BDT Bering Daylight Time CST Central Standard Time CDT Central Daylight Time EST Eastern Standard Time EDT Eastern Daylight Time GMT Greenwich Mean Time HST Alaska-Hawaii Standard Time HDT Alaska-Hawaii Daylight Time MST Mountain Standard Time MDT Mountain Daylight Time NST Newfoundland Standard Time PST Pacific Standard Time PDT Pacific Daylight Time YST Yukon Standard Time YDT Yukon Daylight Time
Returns
The NEW_TIME function returns a date value.
Applies To
The NEW_TIME function can be used in the following versions of Oracle/PLSQL:
- Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i
Example
Let's look at some Oracle NEW_TIME function examples and explore how to use the NEW_TIME function in Oracle/PLSQL.
For example:
The following NEW_TIME function example converts an Atlantic Standard Time into a Mountain Standard Time:
NEW_TIME (TO_DATE ('2003/11/01 01:45', 'yyyy/mm/dd HH24:MI'), 'AST', 'MST')
This example would return '2003/10/31 10:45:00 PM'.
Advertisements