In this tutorial we will explain how to use the Oracle PL/SQL CURRENT_DATE function with syntax and examples
CURRENT_DATE Function :
CURRENT_DATE Function :
Syntax : CURRENT_DATE ;
- CURRENT_DATE returns the current date in the session time zone, in a value in the Gregorian calendar of datatype DATE.
- Return type is of data type DATE.
- There are no input parameters to this function.
- The output date can be altered by changing the timezone.
In the below Example 1 the CURRENT_DATE returns the date as per the timezone of UTC-5 and in NLS_DATE_FORMAT of DD-MON-YYYY HH24:MI:SS
In Example 2 , the session is altered to a timezone of UTC-7.
EXAMPLE :1
ALTER SESSION SET TIME_ZONE = '-5:0';
SELECT CURRENT_DATE FROM DUAL;
CURRENT_DATE
--------------------
31-MAR-2015 18:14:08
EXAMPLE :2
ALTER SESSION SET TIME_ZONE = '-7:0';
SELECT CURRENT_DATE FROM DUAL;
CURRENT_DATE
--------------------
31-MAR-2015 16:14:08
No comments:
Post a Comment
Please Provide your feedback here