ID: 46993 Updated by: tony2...@php.net Reported By: anomie at users dot sourceforge dot net -Status: Open +Status: Assigned Bug Type: Date/time related Operating System: Linux PHP Version: 5CVS,6CVS (2009-01-02) -Assigned To: +Assigned To: derick
Previous Comments: ------------------------------------------------------------------------ [2009-01-02 16:24:10] anomie at users dot sourceforge dot net 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46993&edit=1