Take the 2-minute tour ×

I have a timestamp field in a postgres database. I would like to select all dates that have happened within the last month. So something like select * from table where timestamp > (current timestamp - 1 month).

share|improve this question

2 Answers 2

up vote 8 down vote accepted
select * from table where timestamp > now() - interval '1 month'
share|improve this answer
perfect, thank you –  carboncomputed Jun 8 '12 at 2:05
(If this was Rails, replace timestamp with created_at) –  Ari Jun 24 at 15:23

To be precise:

FROM   tbl
WHERE  ts_col >  now() - interval '1 month'
AND    ts_col <= now();
share|improve this answer

Your Answer


