Edit report at http://bugs.php.net/bug.php?id=53417&edit=1
ID: 53417 Updated by: [email protected] Reported by: trevor dot white at ge dot com Summary: strtotime does not handle MySQL Fuzzy Dates Correctly -Status: Open +Status: Bogus Type: Bug Package: Date/time related Operating System: Redhat PHP Version: 5.3.1RC1 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php This is how it is supposed to be. Day 0 is an underflow, so the date gets auto corrected to 2010-09-30 (from 2010-10-00). (You seem to be confusing 10 with November in your report btw). Previous Comments: ------------------------------------------------------------------------ [2010-11-26 16:03:25] trevor dot white at ge dot com Description: ------------ The function strtotime doesn't handle MySQL fuzzy dates correctly, in MySQL it is possible to store fuzzy dates replacing the unknown date figure with 00, for example. 2010-10-00 00:00:00 which is UK format Y-m-d If you pass this script to strtotime and wrap the date function around it: date('M y', (strtotime($monrow['eventdate']))); PHP will return Oct 10, which is a month out as it should return Nov 10. Workaround is to use str_replace to change the 00 to 01 when processing. Test script: --------------- date('M y', (strtotime("2010-10-00 00:00:00"))); Expected result: ---------------- Nov 10 (Month as specified) Actual result: -------------- Oct 10 (Previous Month) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/bug.php?id=53417&edit=1
