Hi,

I mean the method subMonth doesn't subtract 5 months correctly. For example
(my timezone is Sao Paulo/Brazil):

date_default_timezone_set('America/Sao_Paulo');
$dt = new Zend_Date();
$dt->subMonth(5);
$result = $dt->toString('dd/MM/yyyy');

On version 1.0.3 $result is the current date minus 5 months (18/10/2007). On
version 1.0.4 and 1.5 $result is always the first day of the month, in that
case, 18/03/2008 - 5 months = 01/10/2007.
I didn't set any specific Zend_Date option.

Thank you




thomasW wrote:
> 
> Hy Thiago,
> 
> please provide us with all informations...
> 
> What do you mean with "the code does not work anymore" ?
> When I run your code it works without problems.
> 
> Which timezone have you set ? ... it's not declared in your example.
> What is the date-time you executed it ?
> What was the result ?
> What did you expect to be returned ?
> Did you set any options before initiation ?
> 
> Greetings
> Thomas Weidner, I18N Team Leader
> http://www.thomasweidner.com
> 
> ----- Original Message ----- 
> From: "tflessak" <[EMAIL PROTECTED]>
> To: <fw-general@lists.zend.com>
> Sent: Tuesday, March 18, 2008 4:05 PM
> Subject: [fw-general] Zend_Date and GMT problem
> 
> 
>>
>> Hi!
>>
>> I was using Zend Framework 1.0.3
>> Into my code there are situations where I use some month calculation like
>> this:
>>
>> $dt = new Zend_Date();
>> $dt->subMonth(5);
>>
>> After update to version 1.5, this code doesn't work anymore.
>> Doing some comparison with version 1.0.3, I could see that the function
>> which manipulates the month calculation includes the function
>> 'DateObject::mktime' it has a boolean parameter called 'gmt'. On version
>> 1.0.3, internally this parameter was false when I call the functions
>> 'subMonth' ou 'addMonth'. On version 1.0.4 and 1.5 the 'gmt' parameter
>> passed to true and consequently internally the 'DateObject::mktime' use 
>> the
>> php function gmmktime.
>> I'm having problems after this modification, because the gmmktime is
>> returning me a wrong date. I tried this code:
>>
>> date_default_timezone_set('America/Sao_Paulo');
>> $dategmt =  @gmmktime(0, 0, 0, 3, 18, 2008);
>> $datemk = @mktime(0, 0, 0, 3, 18, 2008);
>>
>> ... and the return of gmmktime is 3 hour less then mktime, and the date 
>> get
>> back to the day before.
>>
>> My question is: Am I doing something wrong? Somebody knows the reason of 
>> why
>> the gmmktime is used instead mktime on version 1.0.4 and 1.5 ?
>>
>> Thank you for help!
>> Regards
>> Thiago
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Zend_Date-and-GMT-problem-tp16122102s16154p16122102.html
>> Sent from the Zend Framework mailing list archive at Nabble.com. 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Date-and-GMT-problem-tp16122102s16154p16126515.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to