DrQuincy Posted October 10 Share Posted October 10 I'm tearing my hair out here. I have a Datetime field and whenever I use it in a selector — regardless of how I use it — no pages are returned. I've: Checked the field name is correct Checked the field type is correct Checked the selector is correct Tried multiple date formats as the selector value The field is called propertyEarliestDate. So, if I do: wire('pages')->find('template=property, propertyEarliestDate>=' . strtotime($myDate)); // $myDate definitely produces the correct Unix timestamp I get an empty array. If I change it to: wire('pages')->find('template=property, propertyEarliestDate<=' . strtotime($myDate)); I still get nothing — even though I have changed to selector to check the opposite. If I remove the selector all together it works. If I remove it, it returns some pages: wire('pages')->find('template=property'); There are definitely pages with propertyEarliestDate populated. Any ideas of anything I might be missing? Thanks. Link to comment Share on other sites More sharing options...
wbmnfktr Posted October 11 Share Posted October 11 Try this: check the returned value of your datefield check the strtotime value returned don't do anything with your datefield value and just try that convert it manually to a timestamp and try that - just to check try if any of these work: $today = strtotime("today"); $todayDate = date('d.m.Y', $today); $todayDateTime = date('d.m.Y H:i:s', $today); last but not least: check the page data if there is anything in them, make a page dump to Tracy or var_dump() That's how I narrow down issue like this. 1 Link to comment Share on other sites More sharing options...
DrQuincy Posted October 14 Author Share Posted October 14 Thank you, this one worked. I couldn't see for looking that the conversion was wrong: Quote convert it manually to a timestamp and try that - just to check 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