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



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/oracle/datetime-functions/oracle-tz_offset-function.php