PostgreSQL Tutorial: CURRENT_DATE Function

September 19, 2023

The PostgreSQL CURRENT_DATE function returns the current date.


The CURRENT_DATE function is so simple that requires no argument as follows:


Return value

The CURRENT_DATE function returns a DATE value that represents the current date.


The following example shows how to use the CURRENT_DATE function to get the current date:


The output is a DATE value as follows:


You can use the CURRENT_DATE function as a default value of a column. Consider the following example.

First, create a table named delivery for demonstration:

CREATE TABLE delivery(
    delivery_id serial PRIMARY KEY,
    product varchar(255) NOT NULL,

In the delivery table, we have the delivery_date whose default value is the result of the CURRENT_DATE function.

Second, insert a new row into the delivery table:

INSERT INTO delivery(product)
VALUES('Sample screen protector');

In this INSERT statement, we did not specify the delivery date, therefore, PostgreSQL used the current date as the default value.

Third, verify whether the row was inserted successfully with the current date by using the following query:

SELECT * FROM delivery;

The following picture illustrates the result:

PostgreSQL CURRENT_DATE example

As you can see, the current date was inserted into the delivery_date column.

Noted that you may see a different value in the delivery_date column, depending on the date you execute the query.

In this tutorial, you have learned how to use the PostgreSQL CURRENT_DATE function to get the current date.

comments powered by Disqus