Home > Back-end >  how to display the current date data for the next 14 days
how to display the current date data for the next 14 days

Time:06-18

i have data in database tbl_product how to display the current date data for the next 14 days ? with postgresql

id | tanggal     | item 
1    2022-06-14    Item a
2    2022-06-29    Item b
3    2022-03-01    Item c
select * from tbl_product where tanggal > current_date   (14 * interval '1' day)

but not work

CodePudding user response:

Try This:

select * from tbl_product where tanggal > current_date   interval 14 day

CodePudding user response:

You need to use between operator to match a value against a range of values.

select * from tbl_product where tanggal between current_date and (current_date   '14 days'::interval)
  • Related