|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-10-29 11:29 UTC] cmb@php.net
-Status: Open
+Status: Verified
[2021-10-29 11:29 UTC] cmb@php.net
[2022-05-13 15:43 UTC] derick@php.net
-Status: Verified
+Status: Not a bug
[2022-05-13 15:43 UTC] derick@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 14:00:01 2025 UTC |
Description: ------------ When time zone is set as America/Toronto, DateTime returns incorrect time on a very specific date (1895-01-01). This happens in PHP version 7.4.20 and possibly in earlier versions (>=7.3.5). Test script: --------------- //fails in 1895-01-01 for($i = 1890; $i <= 1910 ; $i++) { $date = new DateTime( $i. '-01-01', new DateTimeZone('America/Toronto')); echo $date->format('Y-m-d H:i:s') . "<br />"; } Expected result: ---------------- For 1895-01-01, it should be 1895-01-01 00:00:00 instead of 1895-01-01 00:17:32. Actual result: -------------- 1890-01-01 00:00:00 1891-01-01 00:00:00 1892-01-01 00:00:00 1893-01-01 00:00:00 1894-01-01 00:00:00 1895-01-01 00:17:32 <========== Expected value: 1895-01-01 00:00:00 1896-01-01 00:00:00 1897-01-01 00:00:00 1898-01-01 00:00:00 1899-01-01 00:00:00 1900-01-01 00:00:00 1901-01-01 00:00:00 1902-01-01 00:00:00 1903-01-01 00:00:00 1904-01-01 00:00:00 1905-01-01 00:00:00 1906-01-01 00:00:00 1907-01-01 00:00:00 1908-01-01 00:00:00 1909-01-01 00:00:00 1910-01-01 00:00:00