Skip Navigation

[Resolved] Wrong results in View filtered by date if WordPress timezone is not UTC

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a View with a post date Query Filter, set to display posts whose publish date is after or equal to: Minute: PAST_ONE(19). However, the filter doesn't seem to be working as expected when I change the WordPress timezone value. It works when set to UTC.

Solution: Check the Query Filter and make sure you have set the Year, Month, Day, and Hour criteria to CURRENT_ONE, otherwise, you will not get the expected results.

Relevant Documentation:
https://toolset.com/documentation/user-guides/date-filters/

This support ticket is created 5 years, 6 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Author
Posts
#1112058

I successfully created a view in the checkout page to render the last created booking / pack post by the current user And set the post date filter as:

Select posts whose
Published date is after or equal to: minute:PAST_ONE(19)

in the Query filter.

The problem is when I set the general wordpress UTC to another country/location.
I currently set it to UTC 0 and the filter works well

Then I added that part:

[wpv-no-items-found]
<h1>Cart Cleared Try Again</h1>
[clear_cart]
[/wpv-no-items-found]
#1112343
Screen Shot 2018-09-20 at 11.30.43 AM.png

Hi can you provide some additional information?
- Change the Query Filter to use "publish date GMT" instead of "publish date" and test again. Is the problem resolved? If not, continue.
- Which WP timezone setting did you choose?
- What is the PHP timezone setting? This is not necessarily the same as the WordPress timezone setting. If you are not sure, upload a phpinfo file as described in the "How to check the PHP version" section here: https://toolset.com/toolset-requirements/
Upload the file to your server then visit the file URL in your browser. Take a screenshot of the "date" section, like I have posted here. Share the screenshot in your next reply.

#1112668

Hello Christian,

I tried both (post date / post date GMT) with no success.
I created a shortcode to make some conditions in the template to get around it. but the filter is not giving the expectation result

#1112673

hidden link

#1113864

Okay please select "CURRENT_ONE" in the post date filter for the following fields:
- Year
- Month
- Day
- Hour

#1113920

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.