Bug #80308 [Com]: strtotime() issue with Nov 1st

From: Date: Mon, 02 Nov 2020 22:56:04 +0000
Subject: Bug #80308 [Com]: strtotime() issue with Nov 1st
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-230072@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80308&edit=1 ID: 80308 Comment by: bruno at leveque dot io Reported by: bruno at leveque dot io Summary: strtotime() issue with Nov 1st Status: Not a bug Type: Bug Package: *General Issues Operating System: Ubuntu 20.04.1 LTS PHP Version: 7.4.12 Block user comment: N Private report: N New Comment: I understand that the Daytime Savings Time change could be at play however why wouldn't this apply to '+2 days' as well?. Previous Comments: ------------------------------------------------------------------------ [2020-11-02 22:47:17] requinix@php.net Apparently you're in one of the timezones where 2020-11-01 was more than 86400 seconds long. ------------------------------------------------------------------------ [2020-11-02 22:45:07] bruno at leveque dot io Description: ------------ strtotime() is encountering issues when dealing with Nov 1st, 2020 specifically. - Adding 2 x 86400 seconds to Nov 1st will actually return Nov 2nd - Adding '+2 days' to the same date returns Nov 3rd This issue does not happen with any other date. Test script: --------------- <?php /* Add 2 days to Oct 1st ** Outputs 2020-10-03 - Correct */ echo strftime('%Y-%m-%d', strtotime('2020-10-01') + (2 * 86400))."\n"; /* Add 2 days to Nov 1st ** Outputs 2020-11-02 - Bug */ echo strftime('%Y-%m-%d', strtotime('2020-11-01') + (2 * 86400))."\n"; /* Add 2 days to Nov 1st ** Outputs 2020-11-03 - Correct */ echo strftime('%Y-%m-%d', strtotime('2020-11-01 + 2 days'))."\n"; Expected result: ---------------- 2020-10-03 2020-11-03 2020-11-03 Actual result: -------------- 2020-10-03 2020-11-02 2020-11-03 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80308&edit=1

« previous php.bugs (#230072) next »