TZ_OFFSET

TZ_OFFSET is a function in SQL that returns the time zone offset of the argument value from UTC (Coordinated Universal Time). This function calculates the difference between the time zone of a specific date and time value and UTC. The output is displayed in an interval format: (+|-)TZH:TZM or a symbolic time zone format.

TZ_OFFSET( timezone_region )

  • timezone_region: This parameter specifies the time zone region for which you want to get the offset. The input should be a VARCHAR2 value containing the desired time zone region name, such as ‘America/New_York’ or ‘Europe/London’. If this parameter is NULL, the function returns the time zone offset of the system’s current session time zone.

Example

SELECT TZ_OFFSET('US/Eastern') from DUAL;

Output

-04:00

Explanation

In the example, the TZ_OFFSET function is used to get the time zone offset for ‘US/Eastern’. The function returns a string in the format ’[+|-] TZH:TZM’ or a time zone offset value. In the output, ‘-04:00’ signifies a timezone that is four hours behind UTC.

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