ID: 40003 Updated by: [EMAIL PROTECTED] Reported By: matt at iws dot co dot nz -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Linux 2.4 PHP Version: 5.2.0 New Comment:
This is not a bug, but expected behaviour. To get the behaviour that you want, simply use "Monday Jan 2007" (without the first). Previous Comments: ------------------------------------------------------------------------ [2007-01-02 23:15:33] matt at iws dot co dot nz Description: ------------ Asking strtotime() for the date of the first occurrence of a particular day of the week, when that day of the week is also the first day of the month, returns the incorrect day. See examples below. Reproduce code: --------------- echo date('Y-m-d', strtotime('first monday jan 2007')); echo date('Y-m-d', strtotime('first monday feb 2007')); echo date('Y-m-d', strtotime('first thursday feb 2007')); echo date('Y-m-d', strtotime('first thursday jan 2007')); Expected result: ---------------- // First Monday Jan 2007 2007-01-01 // First Monday Feb 2007 2007-02-05 // First Thursday Feb 2007 2007-02-01 // First Thursday Jan 2007 2007-01-04 Actual result: -------------- // First Monday Jan 2007 - incorrect 2007-01-08 // First Monday Feb 2007 - correct 2007-02-05 // First Thursday Feb 2007 - incorrect 2007-02-08 // First Thursday Jan 2007 - correct 2007-01-04 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40003&edit=1