CURRENT_DATE
CURRENT_DATE()
Section titled “CURRENT_DATE()”Example
Section titled “Example”SELECT CURRENT_DATE();Output
Section titled “Output”'2022-04-15'Explanation
Section titled “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()
Section titled “CURRENT_DATE()”Example
Section titled “Example”SELECT CURRENT_DATE;Output
Section titled “Output” current_date-------------- 2022-01-01(1 row)Explanation
Section titled “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()
Section titled “CURRENT_DATE()”Example
Section titled “Example”SELECT CURRENT_TIMESTAMP;Output
Section titled “Output”2022-06-14 15:45:00.247Explanation
Section titled “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()
Section titled “CURRENT_DATE()”Example
Section titled “Example”SELECT CURRENT_DATE FROM dual;Output
Section titled “Output”CURRENT_DATE-------------21-SEP-21Explanation
Section titled “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();
Section titled “CURRENT_DATE();”Example
Section titled “Example”SELECT CURRENT_DATE;Output
Section titled “Output”'2022-12-05'Explanation
Section titled “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.