MarcC Posted July 24, 2013 Share Posted July 24, 2013 I tried "-1 day" on a whim and it worked, so I'm curious where I can find other selectors for date fields? I tried searching the forums, cheat sheet, and selectors page on the main site. Thanks! Link to comment Share on other sites More sharing options...
kongondo Posted July 24, 2013 Share Posted July 24, 2013 The rest are in Soma's head The guy knows everything . Jokes aside, I think they are buried deep in PW code. I recall Soma saying when he was getting started he studied module code and looked in PW modules, etc. Edit: Adding hopefully relevant links to collate date selector stuff in one place.. http://processwire.com/talk/topic/3290-sort-by-date-range/ http://processwire.com/talk/topic/2795-selector-with-dates-and-checkboxes/ http://processwire.com/talk/topic/2260-search-articles/ - Nice one! See post by Ryan 2 Link to comment Share on other sites More sharing options...
MarcC Posted July 24, 2013 Author Share Posted July 24, 2013 I have no problem looking in the source. Maybe I'll just do that. Thanks. Link to comment Share on other sites More sharing options...
kongondo Posted July 25, 2013 Share Posted July 25, 2013 I have a feeling PW date selectors will obey stuff you can throw at PHP strtotime 1 Link to comment Share on other sites More sharing options...
MarcC Posted July 25, 2013 Author Share Posted July 25, 2013 Ohhh...that would make sense. Thanks. Link to comment Share on other sites More sharing options...
teppo Posted July 25, 2013 Share Posted July 25, 2013 Direct quote from Ryan, taken from the first thread linked up there: ... you would just want your date to be in a format that is either a unix timestamp, or a string recognized by PHP strtotime(). So yes, that's how it works. Taking a quick look at source, when asked for a database query Datetime fieldtype simply converts selector value to date with format 'Y-m-d H:i:s', right after sanitizing it (in which process any non-timestamp value is parsed by strtotime()). Digging through PW source is actually fun.. and also the only way to be 100% sure what's really going on and what kind of values will work 5 Link to comment Share on other sites More sharing options...
kongondo Posted July 25, 2013 Share Posted July 25, 2013 +Teppo.... +Ryan's code is really well-commented and written Link to comment Share on other sites More sharing options...
MatthewSchenker Posted July 25, 2013 Share Posted July 25, 2013 I have a feeling PW date selectors will obey stuff you can throw at PHP strtotime Greetings, As far as my experince goes, this is true. I use various date calls all the time in my ProcessWire sites, mixing ProcessWire and good old PHP to get what I need. To add one more link to kongondo's list, Ryan and I posted a bit on this here: http://processwire.com/talk/topic/2600-datetime-field-issue-with-dev/?p=25648 Thanks, Matthew 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now