Airtable Formula with Multiple Date Criteria

I have a scenario to query entries from Airtable with a field of “CollectionDate” within the last 24 hours. This query works to get any entry older than right now. I’m formatting the date and time this way because it wasn’t working with the default format due to 24-hour formatting differences.
CollectionDate < "{{formatDate(now; "YYYY-MM-DDTHH:mm:SSS")}}"

However, I can’t seem to find a way to add another condition to include anything newer than 24 hours ago. This does not work:

AND (CollectionDate < "{{formatDate(now; "YYYY-MM-DDTHH:mm:SSS")}}",CollectionDate > "adddays(formatdate(now; "YYYY-MM-DDTHH:mm:SSS");-1))

What would be the best way to query entries only from the last day?


The formula should work, the only concern is the timezone in Airtable, Something like this that you are using should work,

AND({Created} < "{{formatDate(now; "YYYY-MM-DDTHH:mm:SSS")}}",{Created}>"{{formatDate(addDays(now; -10); "YYYY-MM-DDTHH:mm:SSS")}}")

The other approach that you can use is airtable date directly,

IS_AFTER({Created}, (DATEADD(TODAY(), -1, 'days')))

Created = CollectionDate, and you can change -1 if you want to go further in the past.

1 Like

The IS_AFTER function was perfect! Thank you so much for the help!