Bug #78691 [Csd->Nab]: DateTime ->modify incorrect behavior in some time zones

From: Date: Fri, 18 Oct 2019 15:13:22 +0000
Subject: Bug #78691 [Csd->Nab]: DateTime ->modify incorrect behavior in some time zones
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223262@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 Updated by: requinix@php.net Reported by: writejohnemail at gmail dot com Summary: DateTime ->modify incorrect behavior in some time zones -Status: Closed +Status: Not a bug Type: Bug Package: Date/time related Operating System: Linux PHP Version: 7.4.0RC4 Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2019-10-18 15:10:51] writejohnemail at gmail dot com This was a timezonedb issue ------------------------------------------------------------------------ [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

« previous php.bugs (#223262) next »