Bug #78496 [Com]: date_create rolls a day back on year 0000 timestamp

From: Date: Mon, 08 Feb 2021 05:01:41 +0000
Subject: Bug #78496 [Com]: date_create rolls a day back on year 0000 timestamp
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231997@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78496&edit=1 ID: 78496 Comment by: justinpor119 at gmail dot com Reported by: dzuczek at dlc-solutions dot com Summary: date_create rolls a day back on year 0000 timestamp Status: Assigned Type: Bug Package: Date/time related Operating System: Linux PHP Version: 7.2.22 Assigned To: derick Block user comment: N Private report: N New Comment: The date was parsed in UTC (GMT) because you provided a date-only string without any time zone indicator. If you had given a date/time string w/o an indicator instead (new Date("2011-09-24T00:00:00")), it would have been parsed in your local timezone. Previous Comments: ------------------------------------------------------------------------ [2020-04-17 06:31:54] alexanderpas at gmail dot com This also affects getting a timestamp out of a DateTime object created with a timestamp. (Where the output should always be the same as the input) See https://bugs.php.net/bug.php?id=78499 which has some additional testcases. ------------------------------------------------------------------------ [2019-09-05 23:41:52] alexanderpas at gmail dot com ISO 8601 defines the year zero as the year 1 BC in the Gregorian calendar. The last few days in January are also affected. ------------------------------------------------------------------------ [2019-09-05 22:12:03] requinix@php.net Related To: Bug #78499 ------------------------------------------------------------------------ [2019-09-05 16:47:38] cmb@php.net Well, actually there is no year 0 in the Gregorian calendar. ------------------------------------------------------------------------ [2019-09-05 16:24:27] dzuczek at dlc-solutions dot com More tests, looks like it's just February dates... 0000-01-20 00:00:00 UTC (works) https://3v4l.org/2hPTv 0000-02-20 00:00:00 UTC (fails) https://3v4l.org/manbk 0000-03-20 00:00:00 UTC (works) https://3v4l.org/SMI46 ------------------------------------------------------------------------ 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=78496 -- Edit this bug report at https://bugs.php.net/bug.php?id=78496&edit=1

« previous php.bugs (#231997) next »