PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References
PostgreSQL Tutorial PostgreSQL Advanced PostgreSQL Database Account Management PostgreSQL References

PostgreSQL CURRENT_DATE Function



The PostgreSQL CURRENT_DATE function returns the current date. This function returns the current date as a 'YYYY-MM-DD' format.

Syntax

CURRENT_DATE

Note: Do not put parentheses () after the CURRENT_DATE function.

Return Value

Returns the current date.

Example 1:

The example below shows the usage of CURRENT_DATE function.

SELECT CURRENT_DATE;
Result: '2021-12-26'

SELECT CURRENT_DATE + 0;
Result: '2021-12-26'

SELECT CURRENT_DATE + 1;
Result: '2021-12-27'

Example 2:

Consider a database table called Employee with the following records:

EmpIDNameCityAgeDate_of_Joining
1JohnLondon252018-05-25
2MarryNew York242018-10-15
3JoParis272019-06-09
4KimAmsterdam302019-09-21
5RameshNew Delhi282019-10-25

To insert a new record in this table, the following statement can be used.

INSERT INTO Employee 
VALUES (6, 'Suresh', 'Mumbai', 28, CURRENT_DATE);

-- see the result
SELECT * FROM Employee;

This will produce a result similar to:

EmpIDNameCityAgeDate_of_Joining
1JohnLondon252018-05-25
2MarryNew York242018-10-15
3JoParis272019-06-09
4KimAmsterdam302019-09-21
5RameshNew Delhi282019-10-25
6SureshMumbai282021-12-26

❮ PostgreSQL Functions