postgres arithmetic in select date now code example
Example 1: today minus 15 days postgresql
--yesterday
SELECT NOW() - INTERVAL '1 DAY';
--Unrelated to the question, but PostgreSQL also supports some shortcuts:
SELECT 'yesterday'::TIMESTAMP, 'tomorrow'::TIMESTAMP, 'allballs'::TIME;
Example 2: select current_timestamp - interval '3 days';
SELECT current_timestamp - interval "3 days";
-- 2020-06-24 08:25:31.759993 America/Los_Angeles