Zend Framework

DayOfYear set and get not consistent

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Not an Issue
  • Affects Version/s: 1.9.5
  • Fix Version/s: 1.9.7
  • Component/s: Zend_Date
  • Labels:
    None

Description

// 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);

Activity

Hide
Greg McDowell added a comment -

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

Show
Greg McDowell added a comment - upon further investigation I believe user error is most likely issue here, not ZF Please cancel and ignore
Hide
Dolf Schimmel (Freeaqingme) added a comment -

Closing as requested as 'not an issue'.

Show
Dolf Schimmel (Freeaqingme) added a comment - Closing as requested as 'not an issue'.
Hide
Thomas Weidner added a comment -

Reopening

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

Show
Thomas Weidner added a comment - Reopening Please don't close issues without reproduction. Even when it's not reproducable it could be in need of a better documentation.
Hide
Thomas Weidner added a comment -

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: http://framework.zend.com/wiki/display/ZFFAQ/Internationalization for details.

Show
Thomas Weidner added a comment - 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: http://framework.zend.com/wiki/display/ZFFAQ/Internationalization for details.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: