postgresqlpostgres-12

How to update a column date of postgres to some days ahead


Im using postgres as my database and I have a table that has a date column. The current value in this column is 2021-04-1 17:19:08

I want to update this column's value and move the date 20 (or any other amount of days) ahead so the new value will be 2021-04-20 17:19:08

the reason Im not doing it manually its because I have too much rows to move ahead so I need a query for that, and I need to freedom to choose the amount of days ahead

Thanks in advance


Solution

  • You can add days using INTERVAL -

    SELECT CURRENT_DATE + INTERVAL '20 days';