Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sudheer Satyanarayana's Blog:
Zend Date Class Constants Cheat Sheet
Dec 28, 2010 @ 16:04:21

Sudheer Satyanarayana has provided a handy cheat sheet for those using the Zend_Date component of the Zend Framework listing the default values of the constants it provides.

Date and time handling in general is a problem in programming. For PHP programmers, there's a good library out there that performs all the difficult tasks and provides convenient APIs. Zend_Date has several constants defined. It is good to know what each one of them represents.

You can either come back to this post if you need a reference or you can download the PDF and have it right at your fingertips.

tagged: zenddate zendframework constants cheatsheet pdf

Link:

Eran Galperin's Blog:
On the pitfalls of date validation with the Zend Framework
Jun 22, 2010 @ 17:58:43

On his techfounder.net blog today Eran Galperin talks about one of the issues you might currently see with the date validation in your Zend Framework application - a problem in the Zend_Validation_Date component related to its use of Zend_Locale.

Zend_Date tries to validate dates according to a given format (with a default fallback). The dangerous behavior is that it tries to convert the given format to a localized format using Zend_Locale. Zend_Locale attempts to detect automatically the locale of the requesting client, and it appears that on the machines that were exhibiting the bug, a different locale was determined than those I was testing it on.

His problem was when the method tried to parse a non-localized date format and ended up converting it based on the local machine's locale settings. To correct the issue, since he didn't really need the autodetect local feature anyway, he just manually set the locale in his bootstrap via a registry setting.

tagged: zendframework zenddate validation locate issue

Link:

Zend Framework By Examples:
Handling dates and times (Zend_Date)
Jan 22, 2010 @ 17:09:45

The Zend Framework By Examples site has posted a recent tutorial about using the Zend_Date component of the Zend Framework to work with dates and times in your PHP applications.

In this example, we get or set dates in different timezones. We display parts of dates and times in various formats. We also get information on sunrise and sunset in several locations.

They also incorporate other components in the examples including Zend_Cache, Zend_Locate and Zend_Registry. Their examples show how to check the locale, verify the timezone and figure out a "date from now". Complete code is included - it's not the best method to handle some parts of the example, but it's a rough guide in the right direction.

tagged: zenddate zendframework tutorial timezone

Link:


Trending Topics: