NEW_TIME
NEW_TIME(date, from_tz, to_tz)
Section titled “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
Section titled “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
Section titled “Output”EST to PST-------------------22-FEB-22 08.00.00Explanation
Section titled “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).