|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-07-29 17:52 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 06:00:02 2025 UTC |
Description: ------------ M-j-Y format dates are parsed correctly if the day is 10-31, but as M-j-Hi if the day is 1-9. Or, you could say that M-j-Hi format dates are parsed correctly if the day is 1-9, but incorrectly if the day is 10-31. Y-M-j format dates are parsed correctly if the day is 10-31, but as Y-M in the timezone UTC-j if the day is 1-9. Or, you could say that this odd method of specifying the time zone fails for UTC-10, UTC-11, and so on. Both M-d-Y and Y-M-d formats are parsed correctly for all days. I would find it more consistent if the M-j-Y and Y-M-j formats were recognized for all days, as the other option would conflict with M-d-Y and Y-M-d recognition and both "M-j-Hi" and "Y-M"-with-timezone seem to be unlikely input formats. This bug is also present in PHP 5.2.6. Reproduce code: --------------- date_default_timezone_set("UTC"); echo date("Y-m-d H:i:s\n", strtotime("Dec-9-2006")); echo date("Y-m-d H:i:s\n", strtotime("9-Dec-2006")); echo date("Y-m-d H:i:s\n", strtotime("2006-Dec-9")); echo date("Y-m-d H:i:s\n", strtotime("Dec-10-2006")); echo date("Y-m-d H:i:s\n", strtotime("10-Dec-2006")); echo date("Y-m-d H:i:s\n", strtotime("2006-Dec-10")); Expected result: ---------------- 2006-12-09 00:00:00 2006-12-09 00:00:00 2006-12-09 00:00:00 2006-12-10 00:00:00 2006-12-10 00:00:00 2006-12-10 00:00:00 Actual result: -------------- 2009-12-09 20:06:00 2006-12-09 00:00:00 2006-12-01 09:00:00 2006-12-10 00:00:00 2006-12-10 00:00:00 2006-12-10 00:00:00