|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2010-11-26 16:17 UTC] derick@php.net
-Status: Open
+Status: Bogus
[2010-11-26 16:17 UTC] derick@php.net
[2010-11-26 16:32 UTC] trevor dot white at ge dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 19:00:01 2025 UTC |
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)