Edit report at https://bugs.php.net/bug.php?id=52480&edit=1
ID: 52480
Comment by: techouse at gmail dot com
Reported by: alex dot joyce at staff dot comcen dot com dot au
Summary: Incorrect difference using DateInterval
Status: Assigned
Type: Bug
Package: Date/time related
Operating System: irrelevant
PHP Version: 7.1
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
I found something weird using timezones yesterday and reported it here https://bugs.php.net/bug.php?id=77571
Basically the DateInterval reports a wrong interval whenever a timezone between UTC+01:00 and
UTC+12:00 is applied. I wrote a bunch of tests with all kinds of timezones here https://github.com/techouse/php-date-interval-timezone-bug
Previous Comments:
------------------------------------------------------------------------
[2019-01-28 12:03:55] cz dot paranoiq at gmail dot com
another funny behavior of diff():
```
$start = new DateTime('1922-03-26 00:00:00');
$end = new DateTime('2000-01-02 00:00:00');
echo $end->diff($start, true)->format('%Y years, %m months, %d days, %h hours, %i
minutes, %s seconds');
```
returns some minutes and seconds, although both times are exact midnight. starts to be broken on
this start date or this interval length. breaks with another start time since PHP 7.3.2RC (somewhere
in 1892)
------------------------------------------------------------------------
[2017-05-25 23:27:56] michael dot moussa at gmail dot com
I have submitted a PR with a test case for this bug:
https://github.com/php/php-src/pull/2539
------------------------------------------------------------------------
[2017-03-23 17:33:25] heiglandreas@php.net
That (https://3v4l.org/1b6fj) looks like a shift of the month number to me. Derick, could you have a
look at that?
------------------------------------------------------------------------
[2017-03-20 11:44:08] requinix@php.net
Happens for March https://3v4l.org/R3LLN but not May https://3v4l.org/nblYg. DST?
------------------------------------------------------------------------
[2017-03-20 11:22:55] tomasz dot majerski at o2 dot pl
Don't close this issue. PHP 7.0.6 still not getting expected results...
$date_start = '2017-03-01';
$date_end = '2017-03-31';
DateInterval Object
(
[y] => 0
[m] => 1
[d] => 2
[h] => 0
[i] => 0
[s] => 0
[weekday] => 0
[weekday_behavior] => 0
[first_last_day_of] => 0
[invert] => 0
[days] => 30
[special_type] => 0
[special_amount] => 0
[have_weekday_relative] => 0
[have_special_relative] => 0
)
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=52480
--
Edit this bug report at https://bugs.php.net/bug.php?id=52480&edit=1