Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you select a date range in postgres?

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).

like image 482
carboncomputed Avatar asked Jul 21 '26 17:07

carboncomputed


1 Answers

select * from table where timestamp > now() - interval '1 month'
like image 94
zerkms Avatar answered Jul 23 '26 07:07

zerkms



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!