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

Why Use Zend_Date?

Zend_Date offers the following features, which extend the scope of PHP date functions:

  • Simple API

    Zend_Date offers a very simple API, which combines the best of date and time functionality from four programming languages. It is possible, for example, to add or compare two times within a single row.

  • Completely internationalized

    All full and abbreviated names of months and weekdays are supported for more than 130 languages. Methods support both input and the output of dates using the localized names of months and weekdays, in the conventional format associated with each locale.

  • Unlimited timestamps

    Although PHP 5.2 docs state, "The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 GMT to Tue, 19 Jan 2038 03:14:07 GMT," Zend_Date supports a nearly unlimited range, with the help of the BCMath extension. If BCMath is not available, then Zend_Date will have reduced support only for timestamps within the range of the float type supported by your server. "The size of a float is platform-dependent, although a maximum of ~1.8e308 with a precision of roughly 14 decimal digits is a common value (that's 64 bit IEEE format)." [ http://www.php.net/float ]. Additionally, inherent limitations of float data types, and rounding error of float numbers may introduce errors into calculations. To avoid these problems, Zend Framework's I18n components use BCMath extension, if available.

  • Support for ISO-8601 date specifications

    ISO-8601 date specifications are supported. Even partially compliant ISO-8601 date specifications will be identified. These date formats are particularly useful when working with databases. for example, even though MsSQL and MySQL differ a little from each other, both are supported by Zend_Date using the Zend_Date::ISO_8601 format specification constant. When date strings conform to "Y/m/d" or "Y-m-d H:i:s", according to PHP date() format tokens, use Zend_Date's built-in support for ISO-8601 formatted dates.

  • Calculate sunrise and sunset

    For any place and day, the times for sunrise and sunset can be displayed, so that you won't miss a single daylight second for working on your favorite PHP project :)

Zend Framework