Bug #78827 [Asn->Dup]: Wrong timestamp

From: Date: Fri, 30 Jul 2021 12:27:53 +0000
Subject: Bug #78827 [Asn->Dup]: Wrong timestamp
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235478@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78827&edit=1 ID: 78827 Updated by: cmb@php.net Reported by: obreham at gmail dot com Summary: Wrong timestamp -Status: Assigned +Status: Duplicate Type: Bug Package: Date/time related Operating System: Ubuntu 16.04.6 LTS PHP Version: 7.3.11 -Assigned To: derick +Assigned To: cmb Block user comment: N Private report: N New Comment: Indeed, duplicate of bug #78080. Previous Comments: ------------------------------------------------------------------------ [2020-01-20 17:28:05] girgias@php.net Related To: Bug #78080 ------------------------------------------------------------------------ [2019-12-01 14:39:50] leo dot sjoberg at gmail dot com PR open at timelib: https://github.com/derickr/timelib/pull/71 ------------------------------------------------------------------------ [2019-11-30 08:42:49] leo dot sjoberg at gmail dot com I was just informed that this is a duplicate of an already existing bug: #78080. ------------------------------------------------------------------------ [2019-11-29 18:53:29] leo dot sjoberg at gmail dot com I can confirm that this is a more general problem that occurs when using strtotime("last $x + $n") where $x is the current weekday, and $n >= 7. e.g running it with "last saturday + 7 days" on a saturday will yield the same results. Note that it only happens for positive numbers greater than or equal to 7, and does not occur for negative numbers. I'm looking through the source now to see if I can find anything relating to this. ------------------------------------------------------------------------ [2019-11-23 13:56:31] obreham at gmail dot com No matter what 'last Sunday' means, when you add '7 day' to it, it should yield 1 more day when compared to adding '6 day' to it; not 8 days. I've been also looking at the documentation (https://www.php.net/manual/en/datetime.formats.relative.php), which gives the following caution: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ «Also observe that the "of" in "ordinal space dayname space 'of' " and "'last' space dayname space 'of' " does something special. [...] "'last' dayname" takes the last dayname from the current day. (Example: "last wed july 2008" means "2008-06-25"; "july 2008" first sets the current date to "2008-07-01" and then "last wed" moves to the previous Wednesday which is "2008-06-25").» ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ But that doesn't explain why 'last Sunday' means something different in 'last Sunday + 6 day' and 'last Sunday + 7 day'. Note that 'last Sunday + 6 day', calculated on a Sunday, should return the equivalent of 'yesterday' or 'last Saturday' (and it does). And 'last Sunday + 7 day', calculated on a Sunday, should return the equivalent of 'today'. It actually returns 'next Sunday'. ------------------------------------------------------------------------ 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=78827 -- Edit this bug report at https://bugs.php.net/bug.php?id=78827&edit=1

« previous php.bugs (#235478) next »