ID: 46970 Updated by: der...@php.net Reported By: supratiksekhar at gmail dot com Status: Bogus Bug Type: *Calendar problems Operating System: Windows PHP Version: 5.2.8 New Comment:
No, 1 is correct. See: http://en.wikipedia.org/wiki/ISO_week#Example_where_the_ISO_week-numbering_year_is_three_days_into_the_previous_Gregorian_year Previous Comments: ------------------------------------------------------------------------ [2008-12-30 12:00:14] supratiksekhar at gmail dot com Thanks for your quick response, I downloaded the PHP Windows snapshot "Windows x86 VC9 (thread safe))" and checked with the date "Mon Dec 29, 2008". It returns the week number of year as "1" where I expect this to return as "53" in ISO standard. Thanks Supratik ------------------------------------------------------------------------ [2008-12-30 10:36:27] der...@php.net 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 W displays the ISO week number, which is really 01 right now (of the ISO year 2009). ------------------------------------------------------------------------ [2008-12-30 09:56:06] supratiksekhar at gmail dot com Description: ------------ I am using php-5.2.6 currently, while writing a function to get week number using date("W") I found that the value it is returning is wrong. I searched for the solution and found that this is a bug [Bug #33957] in PHP which is already being solved. But when I try for the year 2008 it returns the wrong value. I tried with the latest version of PHP but the problem is still there. Thanks Supratik Reproduce code: --------------- $datestr = "2008-12-29 00:00:00"; $da = new DateTime($datestr); $t = $da->format("U"); echo "Week number: " . date("W", $t); Expected result: ---------------- Week number: 53 Actual result: -------------- Week number: 01 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=46970&edit=1