$date1 = new Zend_Date('2011-11-14 10:45:00');
$date2 = new Zend_Date('2011-11-14 19:15:00');
if ($date1->compareDay($date2) === 0) {
echo 'same day';
}
Also see the chapter Comparing dates with a Zend date.
In the browser, I highly recommend that you check to see if you have a need Zend_Date. Do not use it just because it is part of ZF. Most of what Zend_Datecan be achieved faster and more conveniently with the native DateTime:
$date1 = new DateTime('2011-11-14 10:45:00');
$date2 = new DateTime('2011-11-14 19:15:00');
if ($date1->diff($date2)->days === 0) {
echo 'same day';
}
PICTURE after comments
If you want to compare whether it makes the same date only
$date1->compareDate($date2)
source
share