CURRENT_DATE function returns the current date in the session time zone.
CURRENT_DATE function requires no argument and its syntax is as simple as follows:
CURRENT_DATE function returns a
DATE value in the Gregorian calendar.
The following statement changes the default date format to a new one that includes the time data:
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
To find out the session time zone, you use the
SESSIONTIMEZONE function as follows:
SELECT SESSIONTIMEZONE FROM DUAL;
Currently, the session time zone is set to
To get the current date in the session time zone, you use the following statement:
SELECT CURRENT_DATE FROM DUAL;
Here is the output:
If you change the session time zone, the value of the current date is adjusted accordingly as shown in the following example:
First, set the session time zone to -09:00:
ALTER SESSION SET TIME_ZONE = '-09:00';
Second, get the current date of in the session time zone:
The new current date was adjusted about -2 hours as expected.
In this tutorial, you have learned how to use the Oracle
CURRENT_DATE function to get the current date and time in the session time zone.