w3resource

Oracle TZ_OFFSET function

Description

The Oracle TZ_OFFSET function returns the time zone offset corresponding to a specified time zone, based on the date when the statement is executed.

Uses of Oracle TZ_OFFSET Function
  • Get Time Zone Offset by Name: Retrieve the offset for a specific time zone name, such as 'Africa/Abidjan'.

  • Get Time Zone Offset by Offset: Accept an offset from UTC in the format {+|-} hh:mi.

  • Get Session Time Zone Offset: Use SESSIONTIMEZONE to return the offset of the current session's time zone.

  • Get Database Time Zone Offset: Use DBTIMEZONE to return the database's time zone offset.

Syntax:

TZ_OFFSET({ 'time_zone_name'
          | '{ + | - } hh : mi'
          | SESSIONTIMEZONE
          | DBTMEZONE
          }
         )

Parameters:

Name Description
TZ_OFFSET A valid time zone. You can enter a valid time zone name, a time zone offset from UTC, or the keyword SESSIONTIMEZONE or DBTIMEZONE.
See the valid Time Zone Region Names list from here.

Applies to:
Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i

Example: Oracle TZ_OFFSET function

The following statement returns the time zone offset of the Africa/Abidjan time zone from UTC:

SQL> SELECT TZ_OFFSET('Africa/Abidjan') FROM DUAL;

Sample Output:

TZ_OFFS
-------
+00:00

Previous: TRUNC(date)
Next: Oracle-character-functions Introduction



Follow us on Facebook and Twitter for latest update.