I wanna query the users who created at 2016-01-10. So code in Laravel 5.1 like this:
$day1 = new Carbon();
$day1->year = 2016;
$day1->month = 1;
$day1->day = 10;
$day2 = new Carbon();
$day2->year = 2016;
$day2->month = 1;
$day2->day = 11;
User::whereBetween('created_at', [$day1->startOfDay(), $day2->startOfDay()])->get();
The codes above works fine. But this normally way, does not:
User::whereBetween('created_at', [$day1->startOfDay(), $day1->endOfDay()])->get();
So what is the problem? thanks a lot.