From Now() to Current_timestamp in Postgresql
You can also use now()
in Postgres. The problem is you can't add/subtract integers from timestamp
or timestamptz
. You can either do as Mark Byers suggests and subtract an interval, or use the date
type which does allow you to add/subtract integers
SELECT now()::date + 100 AS date1, current_date - 100 AS date2
Use an interval instead of an integer:
SELECT *
FROM table
WHERE auth_user.lastactivity > CURRENT_TIMESTAMP - INTERVAL '100 days'