Skip Navigation

[Closed] Filtering data according to the date and time

This support ticket is created 3 years, 11 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: Africa/Casablanca (GMT+00:00)

This topic contains 3 replies, has 2 voices.

Last updated by Jamal 3 years, 11 months ago.

Assisted by: Jamal.

Author
Posts
#1576793

Tell us what you are trying to do?

I have multiple products with a custom field as "class-date" which is a date type field where the date and time of class are recorded. I want to create a search view where I could allow users to search on the products which are not passed. This should be perfect for seconds.

I would also want users to be able to search over the dates through date picker for dates which are after NOW();
[this is also an important requirement as it would be difficult for the user to search dates which are too away from the present date]

_______________________________________________________
Is there any documentation that you are following?

https://toolset.com/documentation/user-guides/views/date-filters/
This seem to be not working for me.
I have also noticed that the timezone for the field is wrong. I outputted raw time and "1586628000" which was

Assuming that this timestamp is in seconds:
GMT: Saturday, April 11, 2020 6:00:00 PM
Your time zone: Saturday, April 11, 2020 11:30:00 PM GMT+05:30
Relative: In 4 days

And the date I entered was : April 11, 2020 6:00:00 PM

My server is :
xxxxxxzx:~# timedatectl
Local time: Tue 2020-04-07 14:27:19 IST
Universal time: Tue 2020-04-07 08:57:19 UTC
RTC time: Tue 2020-04-07 08:57:20
Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes
systemd-timesyncd.service active: yes
RTC in local TZ: no

Also in my WordPress, I have selected my timezone.
How can I fix this too?

__________________________________________________________
What is the link to your site?

The link to the search page is: hidden link

#1577493

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

Your query filter should be like this image but using "greater" instead of "equal" https://toolset.com/wp-content/uploads/2018/09/toolset-views-date-filter-example.jpg

To restrict the date picker to dates after now(); you will need to use a custom Javascript code. Check the documentation for the date picker here hidden link
And see some similar tickets for inspiration here:
- https://toolset.com/forums/topic/set-min-date-for-end-date-greater-start-end-selection/
- https://toolset.com/forums/topic/set-mindate-as-today-for-custom-date-field/
- https://toolset.com/forums/topic/calendar-dates/

I hope this answers your first questions, regarding the timezone, I am not sure to understand what do you mean, do you think that the date field is not saved with the correct timezone? Do you mean saved with the correct user date despite of the site timezone?

#1578143
Annotation 2020-04-08 114159.png

No, it's not working. I have attached the screenshot of my filter view. You can also test the link at: hidden link

regarding the timezone, I am not sure to understand what do you mean, do you think that the date field is not saved with the correct timezone? Do you mean saved with the correct user date despite of the site timezone?

-- After adding a date and time, of April 11, 2020 18:00 PM the timestamp comes to be : 1586628000 which definitely converts to ; Saturday, April 11, 2020 6:00:00 PM in GMT but it[the tool I use to check hidden link; also says Your time zone: Saturday, April 11, 2020 11:30:00 PM GMT+05:30.

Should the time be saved in my timezone. Because when I saved a time, I am thinking that this is in my timezone.

#1578669

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

I will need to take a closer look into your views. Please allow me temporary access to your site. Your next reply will be private to let you share credentials safely.
** Take a database backup before sharing credentials **

The topic ‘[Closed] Filtering data according to the date and time’ is closed to new replies.