$date1 = new Zend_Date('2022-06-15', 'yyyy-MM-dd'); $date2 = new Zend_Date('2022-06-25', 'yyyy-MM-dd'); if ($date2->isLater($date1)) { echo 'Date 2 is later than Date 1'; } else { echo 'Date 2 is not later than Date 1'; }
$date1 = new Zend_Date('2022-06-15 12:00:00', 'yyyy-MM-dd HH:mm:ss'); $date2 = new Zend_Date('2022-06-15 13:00:00', 'yyyy-MM-dd HH:mm:ss'); if ($date2->isLater($date1)) { echo 'Date 2 is later than Date 1'; } else { echo 'Date 2 is not later than Date 1'; }In this example, we create two date objects that have the same date but different times. Again, using isLater, we compare the two dates and find that Date 2 is indeed later than Date 1. The output will be 'Date 2 is later than Date 1'. Overall, Zend_Date isLater function is highly useful when working with date and time data and allows for quick and easy comparison of dates.