tech on the net

Oracle/PLSQL: NEW_TIME Function

Learn how to use the Oracle/PLSQL NEW_TIME function with syntax and examples.

Description

The Oracle/PLSQL NEW_TIME function returns a date in time zone1 to a date in time zone2.

Syntax

The syntax for the Oracle/PLSQL NEW_TIME function is:

NEW_TIME( date, zone1, zone2 )

Parameters or Arguments

zone1 and zone2 can be any of the following values:

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

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 you would 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'.