Bug #52798 [NEW]: dateTime => function diff => days KO
| From: | ebinachon at pierre-vacances dot fr | Date: | Wed, 08 Sep 2010 15:19:53 +0000 |
| Subject: | Bug #52798 [NEW]: dateTime => function diff => days KO | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-154182@lists.php.net to get a copy of this message | ||
From:
Operating system: windows xp
PHP version: 5.3.3
Package: Date/time related
Bug Type: Bug
Bug description:dateTime => function diff => days KO
Description:
------------
I have a probleme with the function diff of dateTime.
When i do a test, the "days" result is always : 6015.
All the other informations ( Y, m, d, ... ) are correct.
Have-you an idea ?
Test script:
---------------
Exemple :
$date1 = new DateTime('2010-01-01');
$date2 = new DateTime('2010-03-13');
$interval = $date2->diff($date1);
Zend_Debug::dump($interval);
//OR
Zend_Debug::dump($interval->format('%a'));
------------------
Result :
object(DateInterval)#174 (8) {
["y"] => int(0)
["m"] => int(2)
["d"] => int(12)
["h"] => int(0)
["i"] => int(0)
["s"] => int(0)
["invert"] => int(0)
["days"] => int(6015)
}
Expected result:
----------------
days => 71
Actual result:
--------------
days => 6015
--
Edit bug report at http://bugs.php.net/bug.php?id=52798&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=52798&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=52798&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=52798&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=52798&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=52798&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=52798&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=52798&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=52798&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=52798&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=52798&r=support
Expected behavior: http://bugs.php.net/fix.php?id=52798&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=52798&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=52798&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=52798&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=52798&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=52798&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=52798&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=52798&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=52798&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=52798&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=52798&r=mysqlcfg