I want to find records between two dates so I have written this code:
$this->paginate['conditions']['OR']['Clients.date_registered BETWEEN ? and ?'] = [$dateRegFrom, $dateRegTo];
date_registered
is a datetime
column so I have tried both the formats
i.e date ('Y-m-d') & date ('Y-m-d H:i:s')
This is how the condition looks like,
[OR] => Array
(
[Clients.date_registered BETWEEN ? and ?] => Array
(
[0] => 2017-11-01 00:00:00 //2017-11-01 in Y-m-d format
[1] => 2018-11-20 22:28:55 //2018-11-20 in Y-m-d format
)
)
But I am getting an error(details)
file : "/vendor/cakephp/cakephp/src/Database/Type/DateTimeType.php"
line : 122
message : "Call to a member function format() on array"
How to get rid of this problem/issue?