DBTIMEZONE Function in Oracle

In Oracle Database, the DBTIMEZONE function returns the value of the database time zone.

Syntax

The syntax goes like this:

DBTIMEZONE

So, no arguments are required (or accepted), and there are no parentheses.

Example

Here’s an example:

SELECT DBTIMEZONE
FROM DUAL;

Result:

+00:00

In this case, the database time zone is set to UTC time zone.

The return type is a time zone offset (a character type in the format '[+|-]TZH:TZM') or a time zone region name, depending on how the database time zone value was specified in the most recent CREATE DATABASE or ALTER DATABASE statement.

Calling DBTIMEZONE with Parentheses

As mentioned, the DBTIMEZONE function is called without parentheses.

Here’s what happens when we call it with parentheses:

SELECT DBTIMEZONE()
FROM DUAL;

Result:

Error starting at line : 1 in command -
SELECT DBTIMEZONE()
FROM DUAL
Error at Command Line : 1 Column : 18
Error report -
SQL Error: ORA-00923: FROM keyword not found where expected
00923. 00000 -  "FROM keyword not found where expected"
*Cause:    
*Action:

Get the Session Time Zone

The time zone of the database may or may not be the same value as the time zone of the current session. This depends on your configuration, and they can both be changed independently of each other.

You can use the SESSIONTIMEZONE function to get the time zone of the current session.