$date1 = new Zend_Date('2021-01-01'); $date2 = new Zend_Date('2021-01-01'); if ($date1->equals($date2)) { echo "The two dates are equal."; } else { echo "The two dates are not equal."; }
$date1 = new Zend_Date('2022-12-31 23:59:59', null, 'en_US'); $date2 = new Zend_Date('2023-01-01 04:59:59', null, 'en_GB'); if ($date1->equals($date2)) { echo "The two dates are equal."; } else { echo "The two dates are not equal."; }Output: The two dates are equal. In conclusion, the given examples illustrate how to use the equals() method in Zend_Date to compare two dates. Zend_Date is part of the Zend Framework Package Library in PHP.