Collection Filtering to current date only

Hey there SiteJet community!
I’ve been trying to figure out how to filter collection items to today’s date only. I’m only able to use !#filter[columns.date] = gt/lt: now. When using just “now” I get an empty result. It almost looks like the function takes time into account because to get the collection item with today’s date I have to use gt: now. I thought about limiting the amount but unfortunately there are different amounts of the collection items for any given date.
Please, advise.

1 Like

Hi @Vlad_goldbyrd,

You’re absolutely right — the now keyword includes both the date and time, so filtering with = now usually returns no results unless the timestamp matches exactly, down to the second.

:magnifying_glass_tilted_left: If you want to filter only items from today’s date, regardless of their time, the best approach is to use a date range filter. Try this:

plaintext

!#filter[columns.date] = gte: today, lt: tomorrow

This will return all items:

  • with a date greater than or equal to today at midnight (00:00), and
  • less than tomorrow at midnight (00:00).

That way, you capture everything from today without worrying about time.

If today and tomorrow aren’t supported directly, try this version instead:

plaintext

!#filter[columns.date] = gte: {{date('today')}}, lt: {{date('tomorrow')}}

Also, make sure the columns.date field is stored as a date type, not a plain text string, so that the comparison works properly.

Hope this helps! Let us know if you need anything else. :waving_hand:


Hey Vlad,

Have you also checked our help article on the Collection Filter?

https://help.sitejet.io/hc/en-us/articles/24275974402327-Collection-Filters