my code:
$startDate = new \DateTime($startDate);
$endDate = new \DateTime($endDate);
User::whereBetween('created_at', [$startDate, $endDate ]);
Execute SQL:
User.aggregate([{"$match":{{"created_at":{"$gte":{"date":"2016-09-01 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Shanghai"},"$lte":{"date":"2017-09-01 00:00:00.000000","timezone_type":3,"timezone":"Asia\/Shanghai"}}},{"deleted_at":null}]}},{"$group":{"aggregate":{"$sum":1},"_id":null}}],{"typeMap":{"root":"array","document":"array"}})
Please help
I also had this problem
I have the same issue.
To fix this I use
where($dateField,'>=',$begin)->where($dateField,'<=',$end)
and works great!
@Wu4m4n me too
I have the same issue.
To fix this I use
where($dateField,'>=',$begin)->where($dateField,'<=',$end)and works great!
i have tried all this earlier, it doesnt work with time, only the date is considered in the quey, i need it to filter date and time
Most helpful comment
I have the same issue.
To fix this I use
where($dateField,'>=',$begin)->where($dateField,'<=',$end)and works great!