Zend_Date support for complete localized dates
- Posted by thomasw at 22:34:18 // //
- Date
Today I added a new feature within Zend_Date which allows to use complete localized dates.
Until Zend Framework 1.8 you had eighter to create your own format manually, or to concat the output manually to get a string like “13.April.2009 10:20:10”.
Actually this formats are very common and as with Zend Framework 1.9 they are supported.
In sum there are 5 variants of this format.
*) Zend_Date::DATETIME
*) Zend_Date::DATETIME_FULL
*) Zend_Date::DATETIME_LONG
*) Zend_Date::DATETIME_MEDIUM
*) Zend_Date::DATETIME_SHORT
As you may have mentioned these new formats are nearly equal to existing ones.
For a date we have Zend_Date::DATE_FULL and for a time representation Zend_Date::TIME_FULL.
In the background DATETIME is defined as a concation of Date and Time. But as we are in a localized environment you have to note that it depends on the locale of the date or the time part is written first and the other part afterwards.
Let’s take a look into a short example:
$date = new Zend_Date(); print $date->toString(Zend_Date::DATETIME_MEDIUM);
This will output 08.07.2009 20:30:33 within the german locale.
But you have to note that the output you will get is still dependent on your locale.
Other new features are on the road and are only waiting for response to be integrated into core.
Greetings
Thomas Weidner
I18N Team Leader, Zend Framework
Zend Framework Advisory Board Member
Zend Certified Engineer for Zend Framework
