I am not able to reproduce your problem...
Using your examplecode I get:
Apr 2008
Mai 2008
Jun 2008

which is what I would expect when adding 1 month 3 times.
Maybe you are using a outdated release ?

Update your ZF version to the actual release (1.5.2) or trunk version.

Greetings
Thomas Weidner, I18N Team Leader, Zend Framework
http://www.thomasweidner.com


----- Original Message ----- From: "aztechy" <[EMAIL PROTECTED]>
To: <fw-general@lists.zend.com>
Sent: Thursday, May 29, 2008 6:41 PM
Subject: [fw-general] Zend_date Confusion



Hello all,

So I've been playing around with Zend_Date to get a feel for it but the
expected behavior of addMonth/subMonth aren't what I expect.  Here's an
example of just some simple testing that doesn't output what I would expect.

Create a previous month, current month, next month display:

<php
date_default_timezone_set('America/Los_Angeles');
$date = Zend_Date::now();  // For this example this returns May 29, 2008
<some time>

// print prev month
$date->subMonth(1);
print $date->toString("MMM YYYY");  // Expected display: April.  Actual
Result April - Good

// print current month
$date->addMonth(1);
print $date->toString("MMM YYYY"); // Expected display: May. Actual Result:
April - Odd?

// print next month
$date->addMonth(1);
print $date->toString("MMM YYYY"); // Expected display: May, Actual Result:
April - Odd?
?>

I found that if I want to return back to the current month, in this case
May, after subtracting a single month I would instead have to do
'$date->addMonth(2);' and make the same call again to advance to the next
month (June).

Is this the way that I am supposed to work with zend date to advance up and
down the months or am I just doing things wrong?

Thanks ahead for any assistance.
--
View this message in context: http://www.nabble.com/Zend_date-Confusion-tp17540531p17540531.html Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to