I have two Datetimes like this (the dates being actually $vars)
$startTime = \\DateTime::createFromFormat(\'Y/m/d H:i\', \'2015/01/01 23:00\'); $endTime = \\Date
Comparing formatted dates is the right thing to do:
$a->format('Y-m-d') === $b->format('Y-m-d')
There is a method for that if you use Carbon:
$dt1->isSameDay($dt2)
So I recommend to use it instead of previous answers given here.
http://carbondoc/docs/#api-comparison