ZF-8497: DayOfYear set and get not consistent

Issue Type: Bug Created: 2009-12-08T12:17:44.000+0000 Last Updated: 2009-12-08T14:10:44.000+0000 Status: Resolved Fix version(s): - 1.9.7 (11/Jan/10)

Reporter: Greg McDowell (gmcdowell) Assignee: Thomas Weidner (thomas) Tags: - Zend_Date

Related issues: Attachments:


// create a date object using a known date $date = new Zend_Date('2009-11-14');

// create a 2nd date object using the setDayOfYear method $date2 = new Zend_Date(); $date2->setDayOfYear(317);

// Results should be equal given that 14th November 2009 is day 317 of the year // however as you can see the 2nd date object returns 316 return $date->get(Zend_Date::DAY_OF_YEAR) . ' ' . $date2->get(Zend_Date::DAY_OF_YEAR);


Posted by Greg McDowell (gmcdowell) on 2009-12-08T12:47:28.000+0000

upon further investigation I believe user error is most likely issue here, not ZF ;) Please cancel and ignore

Posted by Dolf Schimmel (Freeaqingme) (freak) on 2009-12-08T13:38:57.000+0000

Closing as requested as 'not an issue'.

Posted by Thomas Weidner (thomas) on 2009-12-08T13:50:24.000+0000


Please don't close issues without reproduction. Even when it's not reproducable it could be in need of a better documentation.

Posted by Thomas Weidner (thomas) on 2009-12-08T14:10:19.000+0000

After reproduction I see that your problem lies within time and timezone.

$date is set on the date alone... resulting into '2009-11-14T00:00:00+01:00'

$date2 is set to now including time and timezone... AFTERWARDS you set the day which result into '2009-11-13T23:02:16+01:00'

As you see, by taking the timezone and time into account these 2 dates are completly different. Still the calculation is CORRECT.

As help for others: When you think that something is wrong please DEBUG your date object. Look into the FAQ:… for details.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.