BlakJak <blakjak@blakjak.sytes.net> writes:
> So to get "five days ago", you would use
> now() - interval '5 days'
Actually, given that the OP seems to only want a date result and not a
time-of-day, I'd suggest something like
current_date - 5
The date-plus-integer and date-minus-integer operators do exactly what
I think is being asked for. timestamp-minus-interval does computations
including fractional days, which will just confuse matters
... especially near DST transition days. For instance, right now I get
regression=# select now();
now
-------------------------------
2003-10-27 01:45:14.458268-05
(1 row)
regression=# select now() - interval '5 days';
?column?
------------------------------
2003-10-22 02:45:20.22788-04
(1 row)
which is correct in one sense but is surely going to confuse some
people.
regards, tom lane