Oracle CURRENT_DATE function
How to get the current date in the session time zone in Oracle?
CURRENT_DATE returns the current date in the session time zone, in a value in the Gregorian calendar of datatype DATE.
Syntax:
CURRENT_DATE
Parameters:
No parameters or arguments
Applies to:
Oracle 12c, Oracle 11g, Oracle 10g, Oracle 9i
Pictorial Presentation
Example: Oracle CURRENT_DATE() function
The following statement shows the current date in 'DD-MON-YYYY HH24:MI:SS' format :
SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
Session altered.
Let display the current date and session timezone.:
SQL> ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
Session altered.
SQL> SELECT CURRENT_DATE, SESSIONTIMEZONE FROM DUAL;
Sample Output:
CURRENT_DATE SESSIONTIMEZONE -------------------- ----------------------- 01-MAY-2015 11:19:41 +05:30
Let change the session timezone using ALTER SESSION command :
SQL> ALTER SESSION SET TIME_ZONE = '-2:0';
Session altered.
Now check the current date and session timezone :
SQL> SELECT CURRENT_DATE, SESSIONTIMEZONE FROM DUAL;
Sample Output:
CURRENT_DATE SESSIONTIMEZONE -------------------- ----------------------- 01-MAY-2015 04:26:26 -02:00
Previous:
ADD_MONTHS
Next:
CURRENT_TIMESTAMP
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework