DateTime attributes are stored as DateTime objects but if you want to filter by a date time attribute you need to format the DateTime. Since this is not documented anywhere as far as I know you have to find where this is being stored in the db so that you can figure out the proper format to use.
Does not work because it can not be converted to string:
$fileList->filterByAttribute(‘capture_time’, $dateTimeObj->format(‘Y-m-d H:i:s’));
It doesn’t bother me so much that you need to format the DateTime into a string. What bothers me is that without proper documentation there’s no way to know this but trial and error. That seems to be the way you are supposed to learn concrete, not with documentation so much as a lot of wasted time trying and failing until you get lucky and figure it out.
@sparkymeister Concrete CMS is a free open source software tool that anyone can use to build a website anywhere. There’s a number of ways you can find support and like every open source community we rely on contributions to code, security, and documentation.
Your filtering post is useful and will benefit the rest of the community. Are you able to add the date and time tricks to the tutorials area? You receive the credit and a mention in our town hall meetings.
Community members can submit tutorials here by clicking write tutorial Tutorials: Learn how to perform common concrete5 Tasks
Also next I’d like to invite you to next Tuesday’s Town hall at 9:30 PDT we come together and discuss what’s going on in the project and there is time for our community to ask questions and give feedback to the core team.
I’m not available mornings. Thanks anyways.
Also, this does not belong in a tutorial. It belongs in the primary documentation.
It occurs to me that I didn’t even know you have that tutorials section. Where is the link to that on your site? I would have thought it would be on the documentation page but it’s not. It does have a few recent tutorials at the bottom of the page but no link to the not so recent tutorials.
But if you are suggesting to other people that they make a tutorial for something like this that should be in the main documentation then you need to check the tutorials to see which ones actually belong in the main docs and not in a tutorial.