PLSQL | DBTIMEZONE Function

The PLSQL DBTIMEZONE function is used for returning the database time zone value. The PLSQL DBTIMEZONE function does not require any parameter to be passed. The DBTIMEZONE function returns a time zone offset and it follows a format of ‘[+|-]TZH:TZM for example -05:00. It may also return the time zone region name, for example, US/Michigan on some devices.

The value returned by the DBTIMEZONE function depends on how it is being specified in the most recent CREATE DATABASE or ALTER DATABASE statement.

Syntax:

DBTIMEZONE

Parameters Used:
The DBTIMEZONE function accepts no parameters.

Return Value:
The DBTIMEZONE function in PLSQL returns a time zone offset or a time zone region name.



Supported Versions of Oracle/PLSQL:

  1. Oracle 12c
  2. Oracle 11g
  3. Oracle 10g
  4. Oracle 9i
  5. Oracle 8i

Example-1: Displaying the database time zone.

SELECT
  DBTIMEZONE
FROM
  dual; 

Output:

+00:00 

The function may return any other value as well since it completely depends on the time zone value set in the user’s device.

Example-2: Displaying the database time zone after altering it using the ALTER statement.<

ALTER DATABASE SET TIME_ZONE = ‘US/Michigan’;

SELECT
  DBTIMEZONE
FROM
  dual; 

Output:

US/Michigan 
My Personal Notes arrow_drop_up


If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :
Practice Tags :


Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.