I need get all posts from the current day (today), with the find
below I'm not getting anything because the field pub_date (datetime)
has time and the new \Datetime()
returns the current date and time so, the date will match but the time not.
$posts = $this->find('all', [
'fields' => [
'Posts.id',
'Posts.title',
'Posts.body',
'Posts.pub_date',
],
'conditions' => [
'Posts.is_active' => true,
'Posts.pub_date' => new \Datetime()
],
]);
In short terms, I need get all posts with date equal "today" dont matter the time.