[php-src] Issue #13857: Unexpected Results with PHP8 date_diff for Different Timezones

From: Date: Mon, 01 Apr 2024 08:48:19 +0000
Subject: [php-src] Issue #13857: Unexpected Results with PHP8 date_diff for Different Timezones
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-246688@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/13857 Author: nnks1010 ### Description In PHP 8.1.25, running date_diff against different time zones returned unexpected results. https://3v4l.org/RFQMt The following code: ```php <?php date_default_timezone_set('Asia/Tokyo'); $nowDate = (new DateTime('2024-04-01 00:49:22'))->setTimeZone(new DateTimeZone('Asia/Tokyo')); $endDate = (new DateTime('2024-04-01 08:48:22'))->setTimeZone(new DateTimeZone('UTC')); echo date_diff($nowDate, $endDate)->format('%Y-%M-%D %H:%I:%S'); ``` Resulted in this output: ``` -1-11-31 07:59:00 ``` But I expected this output instead: ``` 00-00-00 07:59:00 ``` ### PHP Version PHP 8.1.25 ### Operating System Ubuntu 22.04

« previous php.bugs (#246688) next »