Skip to main content
12 events
when toggle format what by license comment
Dec 3, 2011 at 1:45 comment added unfulvio ok it's working and yyyy-mm-dd works; I couldn't get the second meta comparison for one year or one month, but thinking about that, maybe it's not a big deal since posts are already ordered by the closest one to present day - thanks a lot :)
Dec 2, 2011 at 18:53 comment added unfulvio let us continue this discussion in chat
Dec 2, 2011 at 18:47 comment added ptriek i guess yyyy-mm-dd could work, you'll have to try..
Dec 2, 2011 at 18:35 vote accept unfulvio
Dec 2, 2011 at 18:35 comment added unfulvio hmm unfortunately not, I'm managing all the custom fields with Advanced Custom Fields plugin (I need to manage dozens of different types of metas) and the users of the wp backend need to see clearly the dates; unix timestamp wouldn't be human readable when they edit or review posts from the backend; I just thought maybe I can force the date to be formatted as yyyy-mm-dd, which should be comparable - oh and thanks for the date-to-unix trick actually I knew how to make time, the problem is how that meta is stored
Dec 2, 2011 at 18:30 history edited ptriek CC BY-SA 3.0
added 217 characters in body
Dec 2, 2011 at 18:29 comment added ptriek can't you change it to unix timestamp before storage? that's exactly what i did - i'll add the code to my answer..
Dec 2, 2011 at 18:10 comment added unfulvio actually I just realized my meta is stored as dd-mm-yyyy ('event_date') but to compare it I should convert it to unix timestamp inside the query or make two queries?
Dec 2, 2011 at 18:08 comment added unfulvio oh yeah, just realized that, thank you :) will try soon and give some feedback
Dec 2, 2011 at 17:50 comment added ptriek shouldn't be to hard i guess, just add a second date variable (eg. $date_end = time()+2629743) - and add an extra AND line to the query (not tested, so not 100% sure..)
Dec 2, 2011 at 17:43 comment added unfulvio oh hi, I edited my post while you replied... I will try your code; but how to compare today and 30 days from now? thanks!
Dec 2, 2011 at 17:37 history answered ptriek CC BY-SA 3.0