How to show only entries from the current day, week, month, or year
💡 New on Gravity Guide: an Advanced Filter extension course with step-by-step instructions and videos. Check it out ➡
The Advanced Filtering extension allows you to filter using date ranges. To modify your filters: edit your View, scroll to the Settings Panel and click on the Filter & Sort tab.
Show only Gravity Forms entries submitted this month
Thanks to the wonders of PHP relative dates, we can create filters that show entries only from this month like this:
To show entries from the current month, we do a few mental gymnastics: instead of saying "show entries from this month," we tell Advanced Filtering to show entries that come between last month and next month. The filters shown are configured to show entries that are after ("is after") last month and before ("is before") next month.
To show only entries submitted this week
To show entries from last week, set Entry Date filters to:
- "is after", value: "Sunday last week"
- "is before", value: "monday next week"
To show only entries submitted today
To show entries from today, set Entry Date filters to:
- "is after", value: "yesterday"
- "is before", value: "tomorrow"
Show only entries from last month
To show entries from last month, you'll need two add an additional OR clause with the "is on" operator:
- "is after", value: "first day of last month" OR "is on", value: "first day of last month"
- "is before", value: "last day of last month" OR "is on", value: "last day of last month"
This relative date technique will work for any Gravity Forms date field
You can use this approach with any Date field, allowing you to show:
- Deadlines that are approaching
- Fulfillment dates happening this week use (greater than "last Sunday" and less than "next Monday")
- Entries created today (greater than "yesterday" and less than "tomorrow")
You can use this website to test your relative dates: http://docs.wp-event-organiser.com/querying-events/relative-date-formats/