> This page location: Date Functions > CURRENT_DATE
> Full Neon documentation index: https://neon.com/docs/llms.txt

# PostgreSQL CURRENT_DATE Function

**Summary**: in this tutorial, you will learn how to use the PostgreSQL `CURRENT_DATE` function to get the current date.

## Introduction to the PostgreSQL CURRENT_DATE function

The `CURRENT_DATE` function returns the current date in the default time zone of the database session.

Here is the basic syntax of the `CURRENT_DATE` function:

```sql
CURRENT_DATE
```

The `CURRENT_DATE` function returns a [`DATE`](../postgresql-tutorial/postgresql-date) value that represents the current date.

Note that the `CURRENT_DATE` function returns the current date without any time information.

## PostgreSQL CURRENT_DATE function examples

Let's explore some examples of using the `CURRENT_DATE` function.

### 1) Basic PostgreSQL CURRENT_DATE function example

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

```sql
SELECT CURRENT_DATE;
```

Output:

```
 current_date
--------------
 2024-01-26
(1 row)

```

### 2) Using the PostgreSQL CURRENT_DATE for date-based filtering

You can use the `CURRENT_DATE` in the `WHERE` clause to filter data based on the current date.

For example, you can retrieve the rentals placed today by comparing the rental date in the `rental` table with the result of the `CURRENT_DATE` function:

```sql
SELECT
  *
FROM
  rental
WHERE
  rental_date = CURRENT_DATE;
```

### 3) Calculating ages

First, create a new table called `employees` with the `date_of_birth` column and insert some data into the table:

```sql
CREATE TABLE employees (
    id SERIAL PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    date_of_birth DATE NOT NULL
);

INSERT INTO employees (name, date_of_birth)
VALUES
    ('John Doe', '1992-05-15'),
    ('Jane Smith', '1995-08-22'),
    ('Bob Johnson', '1998-11-10')
RETURNING *;
```

Output:

```
 id |    name     | birth_date
----+-------------+------------
  1 | John Doe    | 1992-05-15
  2 | Jane Smith  | 1995-08-22
  3 | Bob Johnson | 1998-11-10
(3 rows)


INSERT 0 3
```

Second, calculate the age of employees using the `CURRENT_DATE` function:

```sql
SELECT
  name,
  date_of_birth,
  CURRENT_DATE as today,
  (CURRENT_DATE - date_of_birth) / 365 AS age
FROM
  employees
ORDER BY
  name;
```

Output:

```
    name     | date_of_birth |   today    | age
-------------+---------------+------------+-----
 Bob Johnson | 1998-11-10    | 2024-01-26 |  25
 Jane Smith  | 1995-08-22    | 2024-01-26 |  28
 John Doe    | 1992-05-15    | 2024-01-26 |  31
(3 rows)
```

### 4) Using the PostgreSQL CURRENT_DATE function as the default value of a column

In practice, you often use the `CURRENT_DATE` function as a default value of a column. For example:

First, [create a table](../postgresql-tutorial/postgresql-create-table) called `delivery`:

```sql
CREATE TABLE delivery(
  delivery_id SERIAL PRIMARY KEY,
  product VARCHAR(255) NOT NULL,
  delivery_date DATE DEFAULT CURRENT_DATE
);
```

In the `delivery` table, the `delivery_date`is set with the default value generated by the `CURRENT_DATE` function.

Second, [insert a new row](../postgresql-tutorial/postgresql-insert) into the `delivery` table:

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

In this `INSERT` statement, we do not specify the delivery date. Therefore, PostgreSQL uses the current date as the default value.

Third, verify the insert:

```sql
SELECT * FROM delivery;
```

Output:

```
 delivery_id |         product         | delivery_date
-------------+-------------------------+---------------
           1 | Sample screen protector | 2024-01-26
(1 row)
```

The output indicates that the statement inserted the current date into the `delivery_date` column.

Note that you will see a different value in the `delivery_date` column, depending on when you execute the query.

## Summary

- Use the PostgreSQL `CURRENT_DATE` function to retrieve the current date.

---

## Related docs (Date Functions)

- [AGE](https://neon.com/postgresql/postgresql-date-functions/postgresql-age)
- [AT TIME ZONE Operator](https://neon.com/postgresql/postgresql-date-functions/postgresql-at-time-zone)
- [CLOCK_TIMESTAMP](https://neon.com/postgresql/postgresql-date-functions/postgresql-clock_timestamp)
- [CURRENT_TIME](https://neon.com/postgresql/postgresql-date-functions/postgresql-current_time)
- [CURRENT_TIMESTAMP](https://neon.com/postgresql/postgresql-date-functions/postgresql-current_timestamp)
- [DATE_PART](https://neon.com/postgresql/postgresql-date-functions/postgresql-date_part)
- [DATE_TRUNC](https://neon.com/postgresql/postgresql-date-functions/postgresql-date_trunc)
- [EXTRACT](https://neon.com/postgresql/postgresql-date-functions/postgresql-extract)
- [ISFINITE](https://neon.com/postgresql/postgresql-date-functions/postgresql-isfinite)
- [JUSTIFY_DAYS](https://neon.com/postgresql/postgresql-date-functions/postgresql-justify_days)
- [JUSTIFY_HOURS](https://neon.com/postgresql/postgresql-date-functions/postgresql-justify_hours)
- [JUSTIFY_INTERVAL](https://neon.com/postgresql/postgresql-date-functions/postgresql-justify_interval)
- [LOCALTIME](https://neon.com/postgresql/postgresql-date-functions/postgresql-localtime)
- [LOCALTIMESTAMP](https://neon.com/postgresql/postgresql-date-functions/postgresql-localtimestamp)
- [MAKE_DATE](https://neon.com/postgresql/postgresql-date-functions/postgresql-make_date)
- [MAKE_INTERVAL](https://neon.com/postgresql/postgresql-date-functions/postgresql-make_interval)
- [MAKE_TIME](https://neon.com/postgresql/postgresql-date-functions/postgresql-make_time)
- [NOW](https://neon.com/postgresql/postgresql-date-functions/postgresql-now)
- [PG_SLEEP](https://neon.com/postgresql/postgresql-date-functions/postgresql-pg_sleep)
- [STATEMENT_TIMESTAMP](https://neon.com/postgresql/postgresql-date-functions/postgresql-statement_timestamp)
- [TIMEOFDAY](https://neon.com/postgresql/postgresql-date-functions/postgresql-timeofday)
- [TO_DATE](https://neon.com/postgresql/postgresql-date-functions/postgresql-to_date)
- [TO_TIMESTAMP](https://neon.com/postgresql/postgresql-date-functions/postgresql-to_timestamp)
