PhpRiot
Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...


When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Comparing Dates

The following basic operations do not have corresponding convenience methods for the date parts listed in Zend_Date API Overview.

Table 48. Date Comparison Methods

Method Explanation
equals()

equals($date, $part = null, $locale = null)

returns TRUE, if $part of $date having locale $locale is the same as this object's date $part, otherwise FALSE

isEarlier()

isEarlier($date, $part = null, $locale = null)

returns TRUE, if $part of this object's date is earlier than $part of $date having a locale $locale

isLater()

isLater($date, $part = null, $locale = null)

returns TRUE, if $part of this object's date is later than $part of $date having a locale $locale

isToday()

isToday()

Tests if today's year, month, and day match this object's date value, using this object's timezone.

isTomorrow()

isTomorrow()

Tests if tomorrow's year, month, and day match this object's date value, using this object's timezone.

isYesterday()

isYesterday()

Tests if yesterday's year, month, and day match this object's date value, using this object's timezone.

isLeapYear()

isLeapYear()

Use isLeapYear() to determine if the current object is a leap year, or use Zend_Date::checkLeapYear($year) to check $year, which can be a string, integer, or instance of Zend_Date. Is the year a leap year?

isDate()

isDate($date, $format = null, $locale = null)

This method checks if a given date is a real date and returns TRUE if all checks are ok. It works like PHP's checkdate() function but can also check for localized month names and for dates extending the range of checkdate()


Zend Framework