CURRENT_DATE
CURRENT_DATE is a built-in function in SQL. It returns the current date according to the system date of the computer executing the SQL query. The date is displayed in 'YYYY-MM-DD' format. The function does not require any parameters.
CURRENT_DATE()
Example
SELECT CURRENT_DATE();
Output
'2022-04-15'
Explanation
The CURRENT_DATE()
function has been used in the SQL query. When executed, it returns the current date. The output shows the date of execution in ‘YYYY-MM-DD’ format.
CURRENT_DATE()
Example
SELECT CURRENT_DATE;
Output
current_date-------------- 2022-01-01(1 row)
Explanation
The CURRENT_DATE
function in PostgreSQL returns the current date. This date is determined by the system clock. The example code runs this function and outputs the current date.
CURRENT_DATE()
Example
SELECT CURRENT_TIMESTAMP;
Output
2022-06-14 15:45:00.247
Explanation
The CURRENT_TIMESTAMP
function returns the current date and time in SQL Server. The returned value includes the date and time to the millisecond.
CURRENT_DATE()
Example
SELECT CURRENT_DATE FROM dual;
Output
CURRENT_DATE-------------21-SEP-21
Explanation
The CURRENT_DATE
function in Oracle returns the current date from the system. The date is returned as a DATE
datatype value with the format ‘DD-MON-YY’. The query above simply fetches and displays the current date from the system. The ‘dual’ is a special one-row table present by default in Oracle database.
CURRENT_DATE();
Example
SELECT CURRENT_DATE;
Output
'2022-12-05'
Explanation
In the above code snippet, the SQL function “CURRENT_DATE” is used to fetch the current date from the system. Be aware that the date returned by the CURRENT_DATE function will depend on the system date where the database is running.