Re: [fw-general] Zend_Date problem

2009-11-10 Thread Thomas Weidner

Timezone ?

Mfg
Thomas

- Original Message - 
From: "umpirsky" 

To: 
Sent: Tuesday, November 10, 2009 2:23 PM
Subject: [fw-general] Zend_Date problem




Hi zf community.

This code:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString(Zend_Date::DATES);

gives date 21.10.2009. for sr_RS locale (similar for other locales), for
en_GB it gives 21 Oct 2009.
I expect 22 Oct 2009. it's whole day missed?!?!?

Any idea?
--
View this message in context: 
http://old.nabble.com/Zend_Date-problem-tp26283342p26283342.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date problem

2009-11-10 Thread kobsu

Try
Zend_Date::setOptions(array('fix_dst' => true));

before
$date = new Zend_Date();


umpirsky wrote:
> 
> Hi zf community.
> 
> This code:
> 
> $date = new Zend_Date(null, null, $locale);
> $date->setTimestamp(1256198496);
> echo $date->getDate()->toString(Zend_Date::DATES);
> 
> gives date 21.10.2009. for sr_RS locale (similar for other locales), for
> en_GB it gives 21 Oct 2009.
> I expect 22 Oct 2009. it's whole day missed?!?!?
> 
> Any idea?
> 

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



Re: [fw-general] Zend_Date problem

2009-11-10 Thread Саша Стаменковић
@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov 10, 2009 at 6:20 PM, kobsu  wrote:

>
> Try
> Zend_Date::setOptions(array('fix_dst' => true));
>
> before
> $date = new Zend_Date();
>
>
> umpirsky wrote:
> >
> > Hi zf community.
> >
> > This code:
> >
> > $date = new Zend_Date(null, null, $locale);
> > $date->setTimestamp(1256198496);
> > echo $date->getDate()->toString(Zend_Date::DATES);
> >
> > gives date 21.10.2009. for sr_RS locale (similar for other locales), for
> > en_GB it gives 21 Oct 2009.
> > I expect 22 Oct 2009. it's whole day missed?!?!?
> >
> > Any idea?
> >
>
> --
> View this message in context:
> http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


Re: [fw-general] Zend_Date problem

2009-11-10 Thread Thomas Weidner
Sorry, but date_default_timezone_set has no effect on the timezone which is 
actually used by the instance of Zend_Date nor has it effect on DST.

My question was related to the instance not your environment.

Why don't you output all dateparts from the instance instead of giving 
partitial informations ?


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

- Original Message - 
From: "Саша Стаменковић" 

To: "kobsu" 
Cc: 
Sent: Wednesday, November 11, 2009 7:59 AM
Subject: Re: [fw-general] Zend_Date problem


@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov 10, 2009 at 6:20 PM, kobsu  wrote:



Try
Zend_Date::setOptions(array('fix_dst' => true));

before
$date = new Zend_Date();


umpirsky wrote:
>
> Hi zf community.
>
> This code:
>
> $date = new Zend_Date(null, null, $locale);
> $date->setTimestamp(1256198496);
> echo $date->getDate()->toString(Zend_Date::DATES);
>
> gives date 21.10.2009. for sr_RS locale (similar for other locales), for
> en_GB it gives 21 Oct 2009.
> I expect 22 Oct 2009. it's whole day missed?!?!?
>
> Any idea?
>

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






Re: [fw-general] Zend_Date problem

2009-11-10 Thread Саша Стаменковић
How do I set timezone to affect Zend_Date component?
I use zend date to create view helper for date formatting.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner wrote:

> Sorry, but date_default_timezone_set has no effect on the timezone which is
> actually used by the instance of Zend_Date nor has it effect on DST.
> My question was related to the instance not your environment.
>
> Why don't you output all dateparts from the instance instead of giving
> partitial informations ?
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> - Original Message - From: "Саша Стаменковић" 
> To: "kobsu" 
> Cc: 
> Sent: Wednesday, November 11, 2009 7:59 AM
> Subject: Re: [fw-general] Zend_Date problem
>
>
>
> @Thomas Weidner
> *
> *
> date_default_timezone_set('Europe/Stockholm'); is in bootstrap.
>
> @kobsu
> *
> *
> *Same result :(
> *
> Regards,
> Saša Stamenković
>
>
> On Tue, Nov 10, 2009 at 6:20 PM, kobsu  wrote:
>
>
>> Try
>> Zend_Date::setOptions(array('fix_dst' => true));
>>
>> before
>> $date = new Zend_Date();
>>
>>
>> umpirsky wrote:
>> >
>> > Hi zf community.
>> >
>> > This code:
>> >
>> > $date = new Zend_Date(null, null, $locale);
>> > $date->setTimestamp(1256198496);
>> > echo $date->getDate()->toString(Zend_Date::DATES);
>> >
>> > gives date 21.10.2009. for sr_RS locale (similar for other locales), for
>> > en_GB it gives 21 Oct 2009.
>> > I expect 22 Oct 2009. it's whole day missed?!?!?
>> >
>> > Any idea?
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>
>>
>>
>


Re: [fw-general] Zend_Date problem

2009-11-11 Thread Thomas Weidner

Creating the instance affects the timezone.
Using set methods affect the timezone.
The manual states multiple ways (more than 20?) to affect the timezone.

In the code you gave the locale affects the timezone.
And we still don't know how your complete date looks like.
So all we can do is prediction.

And using your code on both locales I get:
sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
en_GB:string '2009-10-22T10:01:36+02:00' (length=25)

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

- Original Message - 
From: "Саша Стаменковић" 

To: "Thomas Weidner" 
Cc: 
Sent: Wednesday, November 11, 2009 8:47 AM
Subject: Re: [fw-general] Zend_Date problem


How do I set timezone to affect Zend_Date component?
I use zend date to create view helper for date formatting.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner 
wrote:


Sorry, but date_default_timezone_set has no effect on the timezone which 
is

actually used by the instance of Zend_Date nor has it effect on DST.
My question was related to the instance not your environment.

Why don't you output all dateparts from the instance instead of giving
partitial informations ?

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

- Original Message - From: "Саша Стаменковић" 
To: "kobsu" 
Cc: 
Sent: Wednesday, November 11, 2009 7:59 AM
Subject: Re: [fw-general] Zend_Date problem



@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov 10, 2009 at 6:20 PM, kobsu  wrote:



Try
Zend_Date::setOptions(array('fix_dst' => true));

before
$date = new Zend_Date();


umpirsky wrote:
>
> Hi zf community.
>
> This code:
>
> $date = new Zend_Date(null, null, $locale);
> $date->setTimestamp(1256198496);
> echo $date->getDate()->toString(Zend_Date::DATES);
>
> gives date 21.10.2009. for sr_RS locale (similar for other locales), 
> for

> en_GB it gives 21 Oct 2009.
> I expect 22 Oct 2009. it's whole day missed?!?!?
>
> Any idea?
>

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









Re: [fw-general] Zend_Date problem

2009-11-11 Thread Саша Стаменковић
Looks like you didn't use my piece of code to reproduce the problem:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString(Zend_Date::DATES);

Using this:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString();

I get

21 Oct 2009 23:00:00

which is again wrong.

If I understand well, Zend_Date is determining which timezone to use by
locale passed in constructor. But by looking in constructor docblock I
figured that it's read from PHP

/**
 * Generates the standard date object, could be a unix timestamp,
localized date,
 * string, integer, array and so on. Also parts of dates or time are
supported
 * Always set the default timezone:
http://php.net/date_default_timezone_set
 * For example, in your bootstrap:
date_default_timezone_set('America/Los_Angeles');
 * For detailed instructions please look in the docu.
 *
 * @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
or value of date part to set
 * ,depending on $part.
If null the actual time is set
 * @param  string  $partOPTIONAL Defines the
input format of $date
 * @param  string|Zend_Locale  $locale  OPTIONAL Locale for
parsing input
 * @return Zend_Date
 * @throws Zend_Date_Exception
 */
public function __construct($date = null, $part = null, $locale = null)

and in line #184 it's obvious

// set the timezone and offset for $this
$zone = @date_default_timezone_get();
$this->setTimezone($zone);

I use zf 1.9.5.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner wrote:

> Creating the instance affects the timezone.
> Using set methods affect the timezone.
> The manual states multiple ways (more than 20?) to affect the timezone.
>
> In the code you gave the locale affects the timezone.
> And we still don't know how your complete date looks like.
> So all we can do is prediction.
>
> And using your code on both locales I get:
> sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
> en_GB:string '2009-10-22T10:01:36+02:00' (length=25)
>
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> - Original Message ----- From: "Саша Стаменковић" 
> To: "Thomas Weidner" 
>
> Cc: 
> Sent: Wednesday, November 11, 2009 8:47 AM
>
> Subject: Re: [fw-general] Zend_Date problem
>
>
> How do I set timezone to affect Zend_Date component?
> I use zend date to create view helper for date formatting.
>
> Regards,
> Saša Stamenković
>
>
> On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner  >wrote:
>
>  Sorry, but date_default_timezone_set has no effect on the timezone which
>> is
>> actually used by the instance of Zend_Date nor has it effect on DST.
>> My question was related to the instance not your environment.
>>
>> Why don't you output all dateparts from the instance instead of giving
>> partitial informations ?
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> - Original Message - From: "Саша Стаменковић" > >
>> To: "kobsu" 
>> Cc: 
>> Sent: Wednesday, November 11, 2009 7:59 AM
>> Subject: Re: [fw-general] Zend_Date problem
>>
>>
>>
>> @Thomas Weidner
>> *
>> *
>> date_default_timezone_set('Europe/Stockholm'); is in bootstrap.
>>
>> @kobsu
>> *
>> *
>> *Same result :(
>> *
>> Regards,
>> Saša Stamenković
>>
>>
>> On Tue, Nov 10, 2009 at 6:20 PM, kobsu  wrote:
>>
>>
>>  Try
>>> Zend_Date::setOptions(array('fix_dst' => true));
>>>
>>> before
>>> $date = new Zend_Date();
>>>
>>>
>>> umpirsky wrote:
>>> >
>>> > Hi zf community.
>>> >
>>> > This code:
>>> >
>>> > $date = new Zend_Date(null, null, $locale);
>>> > $date->setTimestamp(1256198496);
>>> > echo $date->getDate()->toString(Zend_Date::DATES);
>>> >
>>> > gives date 21.10.2009. for sr_RS locale (similar for other locales), >
>>> for
>>> > en_GB it gives 21 Oct 2009.
>>> > I expect 22 Oct 2009. it's whole day missed?!?!?
>>> >
>>> > Any idea?
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Zend_Date-problem-tp26283342p26287337.html
>>> Sent from the Zend Framework mailing list archive at Nabble.com.
>>>
>>>
>>>
>>>
>>
>


Re: [fw-general] Zend_Date problem

2009-11-11 Thread Thomas Weidner

Looks like you didn't use my piece of code to reproduce the problem:


Look like you did not output all date parts.
Why should I use your code when it's obviously wrong ?

You set the actual date with time, timezone and DST.
F.e. 2009-11-11 05:00:00+02:00

Then you set a timestamp overwriting the previous date and time but leaving 
timezone and DST.

This leads to 2009-10-22 10:01:36+02:00.

Then you cut of the time from the instance but still using DST.

Reason:
You used getDate - this strips the time and returns ONLY date
2009-10-22 10:01:36+02:00 -> before
2009-10-22 00:00:00 (+02:00->trunking time internally by getDate())
2009-10-21 22:00:00 (+00:00-> trunking timezone and DST)
2009-10-21 23:00:00 (+01:00 -> trunking DST only by getDate() as a pure date 
without time can not have DST, but adding timezone as it is locale 
dependend, this value is set)


Your problem is that you are mixing date only calculation with date/time 
calculation. By stripping parts in the middle of your calculation you get 
unexpected behaviour.


Why don't you set the time to 0 (setTime() instead of getDate()) or simply 
use the instance as is and output the date only 
(toString(Zend_Date::DATES))?


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

- Original Message - 
From: "Саша Стаменковић" 

To: "Thomas Weidner" 
Cc: 
Sent: Wednesday, November 11, 2009 9:44 AM
Subject: Re: [fw-general] Zend_Date problem


Looks like you didn't use my piece of code to reproduce the problem:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString(Zend_Date::DATES);

Using this:

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->getDate()->toString();

I get

21 Oct 2009 23:00:00

which is again wrong.

If I understand well, Zend_Date is determining which timezone to use by
locale passed in constructor. But by looking in constructor docblock I
figured that it's read from PHP

/**
* Generates the standard date object, could be a unix timestamp,
localized date,
* string, integer, array and so on. Also parts of dates or time are
supported
* Always set the default timezone:
http://php.net/date_default_timezone_set
* For example, in your bootstrap:
date_default_timezone_set('America/Los_Angeles');
* For detailed instructions please look in the docu.
*
* @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
or value of date part to set
* ,depending on $part.
If null the actual time is set
* @param  string  $partOPTIONAL Defines the
input format of $date
* @param  string|Zend_Locale  $locale  OPTIONAL Locale for
parsing input
* @return Zend_Date
* @throws Zend_Date_Exception
*/
   public function __construct($date = null, $part = null, $locale = null)

and in line #184 it's obvious

// set the timezone and offset for $this
$zone = @date_default_timezone_get();
$this->setTimezone($zone);

I use zf 1.9.5.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner 
wrote:



Creating the instance affects the timezone.
Using set methods affect the timezone.
The manual states multiple ways (more than 20?) to affect the timezone.

In the code you gave the locale affects the timezone.
And we still don't know how your complete date looks like.
So all we can do is prediction.

And using your code on both locales I get:
sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
en_GB:string '2009-10-22T10:01:36+02:00' (length=25)


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

- Original Message ----- From: "Саша Стаменковић" 
To: "Thomas Weidner" 

Cc: 
Sent: Wednesday, November 11, 2009 8:47 AM

Subject: Re: [fw-general] Zend_Date problem


How do I set timezone to affect Zend_Date component?
I use zend date to create view helper for date formatting.

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 8:21 AM, Thomas Weidner wrote:

 Sorry, but date_default_timezone_set has no effect on the timezone which

is
actually used by the instance of Zend_Date nor has it effect on DST.
My question was related to the instance not your environment.

Why don't you output all dateparts from the instance instead of giving
partitial informations ?

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

- Original Message - From: "Саша Стаменковић" 
To: "kobsu" 
Cc: 
Sent: Wednesday, November 11, 2009 7:59 AM
Subject: Re: [fw-general] Zend_Date problem



@Thomas Weidner
*
*
date_default_timezone_set('Europe/Stockholm'); is in bootstrap.

@kobsu
*
*
*Same result :(
*
Regards,
Saša Stamenković


On Tue, Nov

Re: [fw-general] Zend_Date problem

2009-11-11 Thread Саша Стаменковић
I see, right way would be :

$date = new Zend_Date(null, null, $locale);
$date->setTimestamp(1256198496);
echo $date->toString(Zend_Date::DATES);

Big thanks Thomas!

Regards,
Saša Stamenković


On Wed, Nov 11, 2009 at 12:06 PM, Thomas Weidner wrote:

> Looks like you didn't use my piece of code to reproduce the problem:
>>
>
> Look like you did not output all date parts.
> Why should I use your code when it's obviously wrong ?
>
> You set the actual date with time, timezone and DST.
> F.e. 2009-11-11 05:00:00+02:00
>
> Then you set a timestamp overwriting the previous date and time but leaving
> timezone and DST.
> This leads to 2009-10-22 10:01:36+02:00.
>
> Then you cut of the time from the instance but still using DST.
>
> Reason:
> You used getDate - this strips the time and returns ONLY date
> 2009-10-22 10:01:36+02:00 -> before
> 2009-10-22 00:00:00 (+02:00->trunking time internally by getDate())
> 2009-10-21 22:00:00 (+00:00-> trunking timezone and DST)
> 2009-10-21 23:00:00 (+01:00 -> trunking DST only by getDate() as a pure
> date without time can not have DST, but adding timezone as it is locale
> dependend, this value is set)
>
> Your problem is that you are mixing date only calculation with date/time
> calculation. By stripping parts in the middle of your calculation you get
> unexpected behaviour.
>
> Why don't you set the time to 0 (setTime() instead of getDate()) or simply
> use the instance as is and output the date only
> (toString(Zend_Date::DATES))?
>
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> ----- Original Message - From: "Саша Стаменковић" 
> To: "Thomas Weidner" 
> Cc: 
> Sent: Wednesday, November 11, 2009 9:44 AM
>
> Subject: Re: [fw-general] Zend_Date problem
>
>
> Looks like you didn't use my piece of code to reproduce the problem:
>
> $date = new Zend_Date(null, null, $locale);
> $date->setTimestamp(1256198496);
> echo $date->getDate()->toString(Zend_Date::DATES);
>
> Using this:
>
> $date = new Zend_Date(null, null, $locale);
> $date->setTimestamp(1256198496);
> echo $date->getDate()->toString();
>
> I get
>
> 21 Oct 2009 23:00:00
>
> which is again wrong.
>
> If I understand well, Zend_Date is determining which timezone to use by
> locale passed in constructor. But by looking in constructor docblock I
> figured that it's read from PHP
>
> /**
>* Generates the standard date object, could be a unix timestamp,
> localized date,
>* string, integer, array and so on. Also parts of dates or time are
> supported
>* Always set the default timezone:
> http://php.net/date_default_timezone_set
>* For example, in your bootstrap:
> date_default_timezone_set('America/Los_Angeles');
>* For detailed instructions please look in the docu.
>*
>* @param  string|integer|Zend_Date|array  $dateOPTIONAL Date value
> or value of date part to set
>* ,depending on $part.
> If null the actual time is set
>* @param  string  $partOPTIONAL Defines the
> input format of $date
>* @param  string|Zend_Locale  $locale  OPTIONAL Locale for
> parsing input
>* @return Zend_Date
>* @throws Zend_Date_Exception
>*/
>   public function __construct($date = null, $part = null, $locale = null)
>
> and in line #184 it's obvious
>
> // set the timezone and offset for $this
> $zone = @date_default_timezone_get();
> $this->setTimezone($zone);
>
> I use zf 1.9.5.
>
> Regards,
> Saša Stamenković
>
>
> On Wed, Nov 11, 2009 at 9:32 AM, Thomas Weidner  >wrote:
>
>  Creating the instance affects the timezone.
>> Using set methods affect the timezone.
>> The manual states multiple ways (more than 20?) to affect the timezone.
>>
>> In the code you gave the locale affects the timezone.
>> And we still don't know how your complete date looks like.
>> So all we can do is prediction.
>>
>> And using your code on both locales I get:
>> sr_RS: string '2009-10-22T10:01:36+02:00' (length=25)
>> en_GB:string '2009-10-22T10:01:36+02:00' (length=25)
>>
>>
>> Greetings
>> Thomas Weidner, I18N Team Leader, Zend Framework
>> http://www.thomasweidner.com
>>
>> - Original Message - From: "Саша Стаменковић" > >
>> To: "Thomas Weidner" 
>>
>> Cc: 
>> Sent: Wednesday, November 11, 2009 8:47 AM
>>
>> Subject: Re: [fw-general] Zend_Date proble

Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-29 Thread Thomas Weidner

Please give the full iso representation as output. (getIso())
All other outputs are useless as they miss needed informations which are not 
provided in your text.


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

- Original Message - 
From: "fab2008" <[EMAIL PROTECTED]>

To: 
Sent: Monday, June 30, 2008 3:08 AM
Subject: [fw-general] Zend_Date problem with add/subMonth()




I'm writing a caledar script for managing orders. I want to implement an 
iCal

like interface for operators, so i created a calendar class; among its
methods I have two methods, getPreviousLink and getNextLink() that point 
to

previous and next month. When I create an object of this class, if no day
parameter is passed, I create an empty Zend_Date representig current date.
Howewer when I build links using Zend_Date::addMonth() and subMonth() I 
get
a very strange (for me) behaviour, i created some test code to reproduce 
the

problem:

Zend_Debug::dump("adding months");
$a = new Zend_Date();
Zend_Debug::dump($a->toString());
for ($i = 0; $i < 24; $i++) {
$a->addMonth(1);
Zend_Debug::dump($a->toString());
}
Zend_Debug::dump("subtracting months");
$a = new Zend_Date();
for ($i = 0; $i < 24; $i++) {
$a->subMonth(1);
Zend_Debug::dump($a->toString());
}

the result for this code is:

string(20) "29/giu/2008 20:56:13"

string(12) "adding months"
string(20) "01/lug/2008 20:56:13"
string(20) "01/lug/2008 20:56:13"
string(20) "01/lug/2008 20:56:13"
string(20) "01/lug/2008 20:56:13"
string(20) "01/lug/2008 20:56:13"
...
string(18) "subtracting months"
string(20) "01/mag/2008 21:02:38"
string(20) "01/mar/2008 21:02:38"
string(20) "01/gen/2008 21:02:38"
string(20) "01/nov/2007 21:02:38"
string(20) "01/set/2007 21:02:38"
string(20) "01/lug/2007 21:02:38"
string(20) "01/mag/2007 21:02:38"
string(20) "01/mar/2007 21:02:38"
...

Is this a bug or i misunderstood Zend_Date::add/subMonth() function?

Can anyone help me?

P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5


--
View this message in context: 
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread fab2008

You're right, here is the iso output (with the same code as above), but the
result is the same :-(

When I add months the date remains unchanged (except for the first add), and
when I subtracting subMonth() subtract two months every step, I'm pretty
confused

string(25) "2008-06-30T08:57:04-04:00"

string(13) "adding months"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
...
string(18) "subtracting months"
string(25) "2008-05-01T08:57:04-04:00"
string(25) "2008-03-01T08:57:04-05:00"
string(25) "2008-01-01T08:57:04-05:00"
string(25) "2007-11-01T08:57:04-04:00"
string(25) "2007-09-01T08:57:04-04:00"
string(25) "2007-07-01T08:57:04-04:00"
string(25) "2007-05-01T08:57:04-04:00"
string(25) "2007-03-01T08:57:04-05:00"
string(25) "2007-01-01T08:57:04-05:00"
string(25) "2006-11-01T08:57:04-05:00"
string(25) "2006-09-01T08:57:04-04:00"
...


thomasW wrote:
> 
> Please give the full iso representation as output. (getIso())
> All other outputs are useless as they miss needed informations which are
> not 
> provided in your text.
> 
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
> 
> - Original Message - 
> From: "fab2008" <[EMAIL PROTECTED]>
> To: 
> Sent: Monday, June 30, 2008 3:08 AM
> Subject: [fw-general] Zend_Date problem with add/subMonth()
> 
> 
>>
>> I'm writing a caledar script for managing orders. I want to implement an 
>> iCal
>> like interface for operators, so i created a calendar class; among its
>> methods I have two methods, getPreviousLink and getNextLink() that point 
>> to
>> previous and next month. When I create an object of this class, if no day
>> parameter is passed, I create an empty Zend_Date representig current
>> date.
>> Howewer when I build links using Zend_Date::addMonth() and subMonth() I 
>> get
>> a very strange (for me) behaviour, i created some test code to reproduce 
>> the
>> problem:
>>
>> Zend_Debug::dump("adding months");
>> $a = new Zend_Date();
>> Zend_Debug::dump($a->toString());
>> for ($i = 0; $i < 24; $i++) {
>> $a->addMonth(1);
>> Zend_Debug::dump($a->toString());
>> }
>> Zend_Debug::dump("subtracting months");
>> $a = new Zend_Date();
>> for ($i = 0; $i < 24; $i++) {
>> $a->subMonth(1);
>> Zend_Debug::dump($a->toString());
>> }
>>
>> the result for this code is:
>>
>> string(20) "29/giu/2008 20:56:13"
>>
>> string(12) "adding months"
>> string(20) "01/lug/2008 20:56:13"
>> string(20) "01/lug/2008 20:56:13"
>> string(20) "01/lug/2008 20:56:13"
>> string(20) "01/lug/2008 20:56:13"
>> string(20) "01/lug/2008 20:56:13"
>> ...
>> string(18) "subtracting months"
>> string(20) "01/mag/2008 21:02:38"
>> string(20) "01/mar/2008 21:02:38"
>> string(20) "01/gen/2008 21:02:38"
>> string(20) "01/nov/2007 21:02:38"
>> string(20) "01/set/2007 21:02:38"
>> string(20) "01/lug/2007 21:02:38"
>> string(20) "01/mag/2007 21:02:38"
>> string(20) "01/mar/2007 21:02:38"
>> ...
>>
>> Is this a bug or i misunderstood Zend_Date::add/subMonth() function?
>>
>> Can anyone help me?
>>
>> P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5
>>
>>
>> -- 
>> View this message in context: 
>> http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
>> Sent from the Zend Framework mailing list archive at Nabble.com. 
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
Sent from the Zend Framework mailing list archive at Nabble.com.



Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread Thomas Weidner

Fab,

Testing your code with the input you gave (timezone, timestamp), I got not 
your output.

Every month is returned as expected.

You have three possibilities:

1.) Use the extended_month option as stated in the manual
2.) Update to the actual release
3.) Install the trunk version

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

- Original Message - 
From: "fab2008" <[EMAIL PROTECTED]>

To: 
Sent: Monday, June 30, 2008 3:02 PM
Subject: Re: [fw-general] Zend_Date problem with add/subMonth()




You're right, here is the iso output (with the same code as above), but 
the

result is the same :-(

When I add months the date remains unchanged (except for the first add), 
and

when I subtracting subMonth() subtract two months every step, I'm pretty
confused

string(25) "2008-06-30T08:57:04-04:00"

string(13) "adding months"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
...
string(18) "subtracting months"
string(25) "2008-05-01T08:57:04-04:00"
string(25) "2008-03-01T08:57:04-05:00"
string(25) "2008-01-01T08:57:04-05:00"
string(25) "2007-11-01T08:57:04-04:00"
string(25) "2007-09-01T08:57:04-04:00"
string(25) "2007-07-01T08:57:04-04:00"
string(25) "2007-05-01T08:57:04-04:00"
string(25) "2007-03-01T08:57:04-05:00"
string(25) "2007-01-01T08:57:04-05:00"
string(25) "2006-11-01T08:57:04-05:00"
string(25) "2006-09-01T08:57:04-04:00"
...


thomasW wrote:


Please give the full iso representation as output. (getIso())
All other outputs are useless as they miss needed informations which are
not
provided in your text.

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

- Original Message - 
From: "fab2008" <[EMAIL PROTECTED]>

To: 
Sent: Monday, June 30, 2008 3:08 AM
Subject: [fw-general] Zend_Date problem with add/subMonth()




I'm writing a caledar script for managing orders. I want to implement an
iCal
like interface for operators, so i created a calendar class; among its
methods I have two methods, getPreviousLink and getNextLink() that point
to
previous and next month. When I create an object of this class, if no 
day

parameter is passed, I create an empty Zend_Date representig current
date.
Howewer when I build links using Zend_Date::addMonth() and subMonth() I
get
a very strange (for me) behaviour, i created some test code to reproduce
the
problem:

Zend_Debug::dump("adding months");
$a = new Zend_Date();
Zend_Debug::dump($a->toString());
for ($i = 0; $i < 24; $i++) {
$a->addMonth(1);
Zend_Debug::dump($a->toString());
}
Zend_Debug::dump("subtracting months");
$a = new Zend_Date();
for ($i = 0; $i < 24; $i++) {
$a->subMonth(1);
Zend_Debug::dump($a->toString());
}

the result for this code is:

string(20) "29/giu/2008 20:56:13"

string(12) "adding months"
string(20) "01/lug/2008 20:56:13"
string(20) "01/lug/2008 20:56:13"
string(20) "01/lug/2008 20:56:13"
string(20) "01/lug/2008 20:56:13"
string(20) "01/lug/2008 20:56:13"
...
string(18) "subtracting months"
string(20) "01/mag/2008 21:02:38"
string(20) "01/mar/2008 21:02:38"
string(20) "01/gen/2008 21:02:38"
string(20) "01/nov/2007 21:02:38"
string(20) "01/set/2007 21:02:38"
string(20) "01/lug/2007 21:02:38"
string(20) "01/mag/2007 21:02:38"
string(20) "01/mar/2007 21:02:38"
...

Is this a bug or i misunderstood Zend_Date::add/subMonth() function?

Can anyone help me?

P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5


--
View this message in context:
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
Sent from the Zend Framework mailing list archive at Nabble.com.






--
View this message in context: 
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
Sent from the Zend Framework mailing list archive at Nabble.com. 




Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread Michael Depetrillo
This is a definite bug with Zend_Date that no one wants to admit.

Use the config option 'extended_month' = true to use Excel style date
addition/subtraction.

On Mon, Jun 30, 2008 at 6:02 AM, fab2008 <[EMAIL PROTECTED]> wrote:

>
> You're right, here is the iso output (with the same code as above), but the
> result is the same :-(
>
> When I add months the date remains unchanged (except for the first add),
> and
> when I subtracting subMonth() subtract two months every step, I'm pretty
> confused
>
> string(25) "2008-06-30T08:57:04-04:00"
>
> string(13) "adding months"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> string(25) "2008-07-01T08:57:04-04:00"
> ...
> string(18) "subtracting months"
> string(25) "2008-05-01T08:57:04-04:00"
> string(25) "2008-03-01T08:57:04-05:00"
> string(25) "2008-01-01T08:57:04-05:00"
> string(25) "2007-11-01T08:57:04-04:00"
> string(25) "2007-09-01T08:57:04-04:00"
> string(25) "2007-07-01T08:57:04-04:00"
> string(25) "2007-05-01T08:57:04-04:00"
> string(25) "2007-03-01T08:57:04-05:00"
> string(25) "2007-01-01T08:57:04-05:00"
> string(25) "2006-11-01T08:57:04-05:00"
> string(25) "2006-09-01T08:57:04-04:00"
> ...
>
>
> thomasW wrote:
> >
> > Please give the full iso representation as output. (getIso())
> > All other outputs are useless as they miss needed informations which are
> > not
> > provided in your text.
> >
> > Greetings
> > Thomas Weidner, I18N Team Leader, Zend Framework
> > http://www.thomasweidner.com
> >
> > - Original Message -
> > From: "fab2008" <[EMAIL PROTECTED]>
> > To: 
> > Sent: Monday, June 30, 2008 3:08 AM
> > Subject: [fw-general] Zend_Date problem with add/subMonth()
> >
> >
> >>
> >> I'm writing a caledar script for managing orders. I want to implement an
> >> iCal
> >> like interface for operators, so i created a calendar class; among its
> >> methods I have two methods, getPreviousLink and getNextLink() that point
> >> to
> >> previous and next month. When I create an object of this class, if no
> day
> >> parameter is passed, I create an empty Zend_Date representig current
> >> date.
> >> Howewer when I build links using Zend_Date::addMonth() and subMonth() I
> >> get
> >> a very strange (for me) behaviour, i created some test code to reproduce
> >> the
> >> problem:
> >>
> >> Zend_Debug::dump("adding months");
> >> $a = new Zend_Date();
> >> Zend_Debug::dump($a->toString());
> >> for ($i = 0; $i < 24; $i++) {
> >> $a->addMonth(1);
> >> Zend_Debug::dump($a->toString());
> >> }
> >> Zend_Debug::dump("subtracting months");
> >> $a = new Zend_Date();
> >> for ($i = 0; $i < 24; $i++) {
> >> $a->subMonth(1);
> >> Zend_Debug::dump($a->toString());
> >> }
> >>
> >> the result for this code is:
> >>
> >> string(20) "29/giu/2008 20:56:13"
> >>
> >> string(12) "adding months"
> >> string(20) "01/lug/2008 20:56:13"
> >> string(20) "01/lug/2008 20:56:13"
> >> string(20) "01/lug/2008 20:56:13"
> >> string(20) "01/lug/2008 20:56:13"
> >> string(20) "01/lug/2008 20:56:13"
> >> ...
> >> string(18) "subtracting months"
> >> string(20) "01/mag/2008 21:02:38"
> >> string(20) "01/mar/2008 21:02:38"
> >> string(20) "01/gen/2008 21:02:38"
> >> string(20) "01/nov/2007 21:02:38"
> >> string(20) "01/set/2007 21:02:38"
> >> string(20) "01/lug/2007 21:02:38"
> >> string(20) "01/mag/2007 21:02:38"
> >> string(20) "01/mar/2007 21:02:38"
> >> ...
> >>
> >> Is this a bug or i misunderstood Zend_Date::add/subMonth() function?
> >>
> >> Can anyone help me?
> >>
> >> P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
> >> Sent from the Zend Framework mailing list archive at Nabble.com.
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>


-- 
Michael DePetrillo
[EMAIL PROTECTED]
Mobile: (858) 761-1605
AIM: klassicd

www.michaeldepetrillo.com


Re: [fw-general] Zend_Date problem with add/subMonth()

2008-06-30 Thread Thomas Weidner

Michael,

when you are getting a reply to your issue from an developer you should also 
answer or give any other response when you it's not solved.
You have been said that your issue has been fixed within the trunk r9450 
which was 6 weeks ago.
But you did not respond so it seems to us that all works like expected. And 
you have not reopened the issue.


Also to say, that your issue is not the same as fab's. You are both just 
using the same function which does not imply the same error.


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

- Original Message - 
From: "Michael Depetrillo" <[EMAIL PROTECTED]>

To: "fab2008" <[EMAIL PROTECTED]>
Cc: 
Sent: Monday, June 30, 2008 8:04 PM
Subject: Re: [fw-general] Zend_Date problem with add/subMonth()



This is a definite bug with Zend_Date that no one wants to admit.

Use the config option 'extended_month' = true to use Excel style date
addition/subtraction.

On Mon, Jun 30, 2008 at 6:02 AM, fab2008 <[EMAIL PROTECTED]> wrote:



You're right, here is the iso output (with the same code as above), but 
the

result is the same :-(

When I add months the date remains unchanged (except for the first add),
and
when I subtracting subMonth() subtract two months every step, I'm pretty
confused

string(25) "2008-06-30T08:57:04-04:00"

string(13) "adding months"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
string(25) "2008-07-01T08:57:04-04:00"
...
string(18) "subtracting months"
string(25) "2008-05-01T08:57:04-04:00"
string(25) "2008-03-01T08:57:04-05:00"
string(25) "2008-01-01T08:57:04-05:00"
string(25) "2007-11-01T08:57:04-04:00"
string(25) "2007-09-01T08:57:04-04:00"
string(25) "2007-07-01T08:57:04-04:00"
string(25) "2007-05-01T08:57:04-04:00"
string(25) "2007-03-01T08:57:04-05:00"
string(25) "2007-01-01T08:57:04-05:00"
string(25) "2006-11-01T08:57:04-05:00"
string(25) "2006-09-01T08:57:04-04:00"
...


thomasW wrote:
>
> Please give the full iso representation as output. (getIso())
> All other outputs are useless as they miss needed informations which 
> are

> not
> provided in your text.
>
> Greetings
> Thomas Weidner, I18N Team Leader, Zend Framework
> http://www.thomasweidner.com
>
> - Original Message -
> From: "fab2008" <[EMAIL PROTECTED]>
> To: 
> Sent: Monday, June 30, 2008 3:08 AM
> Subject: [fw-general] Zend_Date problem with add/subMonth()
>
>
>>
>> I'm writing a caledar script for managing orders. I want to implement 
>> an

>> iCal
>> like interface for operators, so i created a calendar class; among its
>> methods I have two methods, getPreviousLink and getNextLink() that 
>> point

>> to
>> previous and next month. When I create an object of this class, if no
day
>> parameter is passed, I create an empty Zend_Date representig current
>> date.
>> Howewer when I build links using Zend_Date::addMonth() and subMonth() 
>> I

>> get
>> a very strange (for me) behaviour, i created some test code to 
>> reproduce

>> the
>> problem:
>>
>> Zend_Debug::dump("adding months");
>> $a = new Zend_Date();
>> Zend_Debug::dump($a->toString());
>> for ($i = 0; $i < 24; $i++) {
>> $a->addMonth(1);
>> Zend_Debug::dump($a->toString());
>> }
>> Zend_Debug::dump("subtracting months");
>> $a = new Zend_Date();
>> for ($i = 0; $i < 24; $i++) {
>> $a->subMonth(1);
>> Zend_Debug::dump($a->toString());
>> }
>>
>> the result for this code is:
>>
>> string(20) "29/giu/2008 20:56:13"
>>
>> string(12) "adding months"
>> string(20) "01/lug/2008 20:56:13"
>> string(20) "01/lug/2008 20:56:13"
>> string(20) "01/lug/2008 20:56:13"
>> string(20) "01/lug/2008 20:56:13"
>> string(20) "01/lug/2008 20:56:13"
>> ...
>> string(18) "subtracting months"
>> string(20) "01/mag/2008 21:02:38"
>> string(20) "01/mar/2008 21:02:38"
>> string(20) "01/gen/2008 21:02:38"
>> string(20) "01/nov/2007 21:02:38"
>> string(20) "01/set/2007 21:02:38"
>> string(20) "01/lug/2007 21:02:38"
>> string(20) "01/mag/2007 21:02:38"
>> string(20) "01/mar/2007 21:02:38"
>> ...
>>
>> Is this a bug or i misunderstood Zend_Date::add/subMonth() function?
>>
>> Can anyone help me?
>>
>> P.S. i've just upgraded to 1.5.2 ZF and my PHP version is 5.2.5
>>
>>
>> --
>> View this message in context:
>>
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18187205.html
>> Sent from the Zend Framework mailing list archive at Nabble.com.
>
>
>

--
View this message in context:
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18195152.html
Sent from the Zend Framework mailing list archive at Nabble.com.





--
Michael DePetrillo
[EMAIL PROTECTED]
Mobile: (858) 761-1605
AIM: klassicd

www.michaeldepetrillo.com





Re: [fw-general] Zend_Date problem with add/subMonth()

2008-07-01 Thread fab2008

Bingo!!

I found my mistake, I set timezone with date_default_timezone_set in my
bootstrap file with the timezone of production server, but I develop on my
laptop which has a different timezone.

What a stupid mistake ;-)

Thanks for helping me.

-- 
View this message in context: 
http://www.nabble.com/Zend_Date-problem-with-add-subMonth%28%29-tp18187205p18220722.html
Sent from the Zend Framework mailing list archive at Nabble.com.