Bug #66545 [NEW]: DateTime
| From: | perrier dot p at gmail dot com | Date: | Wed, 22 Jan 2014 14:13:42 +0000 |
| Subject: | Bug #66545 [NEW]: DateTime | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183953@lists.php.net to get a copy of this message | ||
From: perrier dot p at gmail dot com
Operating system: Debian 7
PHP version: 5.5.8
Package: Date/time related
Bug Type: Bug
Bug description:DateTime
Description:
------------
DateInterval fail to calculate number of days and hours
http://3v4l.org/ab0Hm#v5424
Test script:
---------------
<?php
$debut = mktime(0, 0, 0, 10, 27, 2013);
$fin = mktime(23, 59, 59, 11, 10, 2013);
$d1 = new DateTime('now',new DateTimeZone('Europe/Paris'));
$d2 = new DateTime('now',new DateTimeZone('Europe/Paris'));
$d1->setTimestamp($debut);
$d2->setTimestamp($fin);
$diff = $d1->diff($d2);
print_r($diff);
Expected result:
----------------
DateInterval Object
(
[y] => 0
[m] => 0
[d] => 14
[h] => 23
[i] => 59
[s] => 59
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 14
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
Actual result:
--------------
DateInterval Object
(
[y] => 0
[m] => 0
[d] => 15
[h] => -1
[i] => 59
[s] => 59
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 14
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
--
Edit bug report at https://bugs.php.net/bug.php?id=66545&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66545&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66545&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66545&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66545&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66545&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66545&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66545&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66545&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66545&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66545&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66545&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66545&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66545&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66545&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66545&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66545&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66545&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66545&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66545&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66545&r=mysqlcfg