Pulling records based on expiration date

I have been trying to solve this problem for some time now and all it's gotten me is aggravation. I have records in my Retool database that contain expiration dates. I've been trying to create a query that will pull back all the records that have an expiration date that is within 30 days of the current date. Nothing I've tried works. Any assistance would be most appreciated.

Hey tomm!

Depending on the DB resource you are using it can be different but I'll provide example code.

Assuming your expiratinon_date is timestamp you could do something like this:

FROM table
WHERE expiratinon_date>={{moment().startOf('day').format('YYYY-MM-DDTHH:mm:ss')}}
AND expiratinon_date<{{moment().add(30,'days').format('YYYY-MM-DDTHH:mm:ss')}}

Hope this helps!

1 Like