Bug #78691 [Opn->Csd]: DateTime ->modify incorrect behavior in some time zones
| From: | writejohnemail at gmail dot com | Date: | Fri, 18 Oct 2019 15:10:51 +0000 |
| Subject: | Bug #78691 [Opn->Csd]: DateTime ->modify incorrect behavior in some time zones | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-223261@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=78691&edit=1
ID: 78691
User updated by: writejohnemail at gmail dot com
Reported by: writejohnemail at gmail dot com
Summary: DateTime ->modify incorrect behavior in some time
zones
-Status: Open
+Status: Closed
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 7.4.0RC4
Block user comment: N
Private report: N
New Comment:
This was a timezonedb issue
Previous Comments:
------------------------------------------------------------------------
[2019-10-18 15:07:26] writejohnemail at gmail dot com
Description:
------------
In time zones that make a daylight savings change at midnight, on the day of the daylight savings
change, ->modify('-1 second') does not work as expected. America/Santiago,
America/Havana, Asia/Tehran, America/Asuncion are a few of the time zones that have this behavior
Test script:
---------------
$timezone = 'America/Santiago';
$dateString = "2020-09-06";
$dt = new \DateTime($dateString);
$dtz = new \DateTimeZone($timezone);
$dt->setTimezone($dtz);
echo 'the start of the day:<br>';
$dt->modify('today');
echo $dt->getTimestamp();
echo '<br><br>the start of the day, minus one second. this is
incorrect:<br>';
$dt->modify('-1 second');
echo $dt->getTimestamp();
Expected result:
----------------
1599364799
Actual result:
--------------
1599368399
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78691&edit=1