w3resource

PostgreSQL CURRENT_DATE() function

CURRENT_DATE() function

This function is used to return the current date.

Uses of CURRENT_DATE() Function
  • Retrieve Current Date: Get the current date without time information.

  • Date Comparisons: Use in SQL queries to compare with other date fields.

  • Date Calculations: Perform date arithmetic for intervals, durations, and other date-related calculations.

  • Report Generation: Generate reports with the current date.

  • Record Creation: Automatically set the creation date for new records.

Syntax:

current_date()

Return Type: date.

PostgreSQL Version: 9.3

Pictorial Presentation of PostgreSQL CURRENT_DATE() function

Pictorial presentation of PostgreSQL CURRENT_DATE() function

Example: PostgreSQL CURRENT_DATE() function

Code:

SELECT current_date;

Sample Output:

    date
------------
 2015-01-14
(1 row)

N.B. - The outputs may change with the current date.

Previous: CLOCK_TIMESTAMP function
Next: CURRENT_TIME function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/PostgreSQL/current_date-function.php