PLSQL | DBTIMEZONE Function
Last Updated :
28 Oct, 2019
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:
- Oracle 12c
- Oracle 11g
- Oracle 10g
- Oracle 9i
- 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
Share your thoughts in the comments
Please Login to comment...