All Products
Search
Document Center

SESSIONTIMEZONE

Last Updated: Jun 18, 2021

The SESSIONTIMEZONE function returns the time zone of the current session.

Syntax

SESSIONTIMEZONE

Parameters

None

Return type

VARCHAR2 data type

Examples

The following statement is used to query the database time zone and the time zone of the current session:

SELECT DBTIMEZONE,SESSIONTIMEZONE FROM DUAL;

The following query result is returned:

+------------+-----------------+
| DBTIMEZONE | SESSIONTIMEZONE |
+------------+-----------------+
| +00:00     | +08:00          |
+------------+-----------------+

You can change the time zone of the current session by using the ALTER SESSION statement, but you cannot change the database time zone.

ALTER SESSION SET TIME_ZONE = '+05:00';

Execute the following statement to query the time zone of the current session after the change:

SELECT DBTIMEZONE,SESSIONTIMEZONE FROM DUAL;

The following query result is returned:

+------------+-----------------+
| DBTIMEZONE | SESSIONTIMEZONE |
+------------+-----------------+
| +00:00     | +05:00          |
+------------+-----------------+