Forums › Forums › Search & Filter Pro › problem with Date picker
Tagged: date, date range
- This topic has 4 replies, 2 voices, and was last updated 9 years, 5 months ago by Anonymous.
-
Anonymous(Private) May 18, 2015 at 7:58 am #17723
First of All thanks!
I just have one problem with Date picker.My fields plugin saves data in 31.12.2015 text format i think.
and in your filters with Date, there is no such format option.
How do you think, will it be possible to add DD.MM.YYYY format, and will it support the date range filter?
Best regards.Ross Moderator(Private) May 21, 2015 at 12:56 pm #18011Hey Yerbol
I think you will need to change the way it is saving the dates.
This is pretty simple really but it because of the way MySQL can search (and order) dates.
A timestamp is a valid time format, and MySQL knows how to sort this.
The format of YYYYMMDD is also a valid date, but it is also a number – which can be used for sorting.
With the dots in between:
DD.MM.YYYY
you actually have a string, a string cannot be searched by MySQL efficiently as date, this field will first need to be transformed to something understandable by MySQL otherwise its not possible.Hope that makes sense.
Thanks
Anonymous(Private) July 4, 2015 at 12:16 am #20724Hi, at the time WP date date format is 04/07/2015
I set up 2 filters:Post Data and Post Meta. http://rabotu.kz/resume-map/#s=1
For Post Date-> Data Range->Date Format->03/07/2015
it is not filtering my posts.FOR Post meta – _cadidate_birthday meta key is found, my settings are: Date Range, Timestamp 03/07/2015 Date display Format.
The problem is that the plugin is not filtering the posts. Despite I am using the 04/07/2015 standard date format.
The search query is like this – http://rabotu.kz/search/?_sfm__candidate_birthday=01072012+08072015#s=1
The filter works only if I change WP date format to – CUSTOM 04072015 but it is looking not good on the site.
Ross Moderator(Private) July 8, 2015 at 12:31 pm #21013Hi Yerbol, you must use the custom format because the other format with
/
is not searchable – this is just the way databases work, you can’t compare a date when in fact it is a string.What I would suggest is to read up on the date format functions – which will allow for a better display in your theme – https://codex.wordpress.org/Formatting_Date_and_Time
Thanks
Anonymous(Private) July 8, 2015 at 2:47 pm #21039Thanks, I understood the problem.
Custom paid plugin on my site is using my WP Date format. It is dd/mm/yyyy but WP saves it as Timestamp format, while the plugin is saving it in dd/mm/yyyy format. I asked the paid plugin developer to fix it, but he is not responding yet. -
AuthorPosts