Open In App

PLSQL | DBTIMEZONE Function

Improve
Improve
Like Article
Like
Save
Share
Report

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 

Last Updated : 28 Oct, 2019
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads