Tag Archives: date

Zend_Date::setOptions and format_type in Zend Framework 1.10.3

I recently upgraded from the old Zend Framework 1.9.5 to the latest – 1.10.3. Everything just looked to be working quite fine, except the date formatting. Although I had the same date formatting and options in the old version it seems to be not working.

I had the format_type set to PHP and even though I formatted the dates with a Zend Framework specific format: “d MMM yyyy”.

Zend_Date::setOptions(array('format_type' => 'php'));
// ...
$date = new Zend_Date($somedate);
echo $date->get('d MMM yyyy');

Now as it appears format_type php in 1.10.3 is giving completely different result, and the correct format is date() like format in PHP.

Zend_Date::setOptions(array('format_type' => 'php'));
// ...
$date = new Zend_Date($somedate);
echo $date->get('d M yy');

Zend_Date with dates before 1901

Zend_Date

Zend_Date is the Zend Framework module for manipulation of dates. It gives several advantages. Everybody how has dealed with dates knows that built in PHP date function cannot manage dates before 1901. With that kind of problems Zend_Date is pretty fine.

How to do that

If you have only

Zend_Date::set($timestamp);

is not enough. The timestamp is an int representation and the framework cannot get the timezone from that and trows an error.

The simple way to solve the problem

Replace the line above with these: Continue reading Zend_Date with dates before 1901

Flex 3: compare two dates

Theory of Operation

You’re using Flex 3 and want to compare two dates. The format of the dates is string something like “2009 May 05”. The question is …

What’s the best way to compare them

Well if you’ve the dates as strings and you can easily conver them to something like unix timestamps. If they are a Date object you can try lik so: Continue reading Flex 3: compare two dates