PostgreSQL – Adding days to Date

In Postgres, you can query today’s date as below:

SELECT current_date;

To get tomorrow’s date, simply add 1 day to the current_date as shown below:

SELECT current_date + 1;

Similarly, to get yesterday’s date, you can subtract 1 day from current_date.

SELECT current_date - 1;

Example:

Syntax to query all employees hired in the last 30 days:

SELECT employee_name from employee where hire_date > current_date -30;
See also  PostgreSQL - Drop User