Home » Date and Time » Date » Bug #7399
getNextDay() function occassionally skips days
Details
| Submitted | 2006-04-14 20:44 UTC |
|---|---|
| From | sandpaperd at yahoo dot com |
| Status | No Feedback |
| Package | Date |
| PHP Version | 5.0.4 |
| OS | Solaris 8 |
| Roadmaps | (Not assigned) |
Comments
[2006-04-14 20:44 UTC] sandpaperd at yahoo dot com
Description:
------------
When using the getNextDay() function, the resulting day is sometimes not actually the next day but instead two days later. I've worked around it using addSpan() instead, which works fine.
Test script:
---------------
$start_date = '2006-02-19';
$end_date = '2006-02-26';
$s_date_o = new Date($start_date);
$e_date_o = new Date($end_date);
$cur_date_o = $s_date_o;
while ($cur_date_o->before($e_date_o)) {
echo $cur_date_o->getDate() ."\n";
$cur_date_o = $cur_date_o->getNextDay();
}
Expected result:
----------------
2006-02-19 xx:00:00
2006-02-20 xx:00:00
2006-02-21 xx:00:00
2006-02-22 xx:00:00
2006-02-23 xx:00:00
2006-02-24 xx:00:00
2006-02-25 xx:00:00
2006-02-26 xx:00:00
I'm not sure what the 'xx' time portion should be.
Actual result:
--------------
2006-02-19 08:00:00
2006-02-20 16:00:00
2006-02-22 00:00:00
2006-02-23 08:00:00
2006-02-24 16:00:00
2006-02-26 00:00:00