Bug #66545 [Com]: DateTime
Edit report at https://bugs.php.net/bug.php?id=66545&edit=1
ID: 66545
Comment by: s dot wuerker at injc dot net
Reported by: perrier dot p at gmail dot com
Summary: DateTime
Status: Open
Type: Bug
Package: Date/time related
Operating System: Debian 7
PHP Version: 5.5.8
Block user comment: N
Private report: N
New Comment:
I've got the same problem with the following code:
http://3v4l.org/ekMU7
Previous Comments:
------------------------------------------------------------------------
[2014-01-22 14:13:42] perrier dot p at gmail dot com
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 this bug report at https://bugs.php.net/bug.php?id=66545&edit=1
Thread (4 messages)