NEW_TIME

NEW_TIME is a date function in Oracle SQL, used to convert a date and time from one time zone to another. Specifically, it allows conversions between Eastern Standard Time and Pacific Standard Time.

NEW_TIME(date, from_tz, to_tz)

  • date: This parameter represents the timestamp or datetime value that you want to convert. It is a mandatory parameter which should contain a valid timestamp value.
  • from_tz: Specifies the timezone of the ‘date’ parameter. This is also a mandatory argument which refers to the current timezone of the provided ‘date’.
  • to_tz: This last parameter indicates the target timezone to which you want to convert the specified ‘date’. It is also a required argument and must contain a valid timezone identifier.

Example

SELECT NEW_TIME(TO_DATE('22-02-2022 11:00:00', 'DD-MM-YYYY HH24:MI:SS'), 'EST', 'PST') "EST to PST"
FROM dual;

Output

EST to PST
-------------------
22-FEB-22 08.00.00

Explanation

The NEW_TIME function converts a date from one time zone to another. In the provided code, the function NEW_TIME is taking a date in ‘EST’ (Eastern Standard Time) and converting it into ‘PST’ (Pacific Standard Time).

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.