Skip Navigation

[Resolved] Problem with setting up Query Filter on Datetime field.

This support ticket is created 2 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by lesleeM 2 years, 2 months ago.

Assisted by: Luo Yang.

Author
Posts
#2478261

I have successfully set up a View that shows all our Rides (custom content type) with various filters added. That page is here:

hidden link

I have then duplicated this view and removed the various filters. That worked fine. What I want to do is to add one Query Filter that will limit the results on the page to only show Rides within the next 7 days. We have 6 test rides in the system, but I had to extend the time period to 10 days to make sure the filter was working because of the dates already entered for these test rides. I set the Query filter and saved it. It now shows as:

Select items with field:
Start Date and Time is a DATETIME between NOW(), FUTURE_DAY(10)

But that is yielding no results on the page here:

hidden link

It should be showing 2 of our test rides dated on October 25 and 26. It may be that the 7 day filter would have worked on the October 25 ride, but I wasn't sure if it would include it right now or not, so I decided to up it 10 days just for testing here. If I can get this to work, I'll put the number of days back to 7.

Can you let me know what I'm doing wrong here? Start Date and Time is a Date field created in our custom Field Group for Rides.

#2478841

Hello,

I assume we are talking about a custom date field created with Toolset Types plugin,
If it is, the custom date field stores value in timestamp format(number), please try to change the date field filter you mentioned above to below:
Select items with field:
Start Date and Time is a number between NOW(), FUTURE_DAY(10)

And test again

More help:
https://toolset.com/course-lesson/filtering-toolset-views-by-dates/#filtering-by-dates-in-custom-fields

#2480685

My issue is resolved now. Thank you!