ID: 24683 Updated by: [EMAIL PROTECTED] Reported By: s dot vanvelthem at ibelgique dot com -Status: Open +Status: Bogus Bug Type: Date/time related Operating System: Redhat Linux 9 PHP Version: 4.3.2 New Comment:
It actually works correctly now. >From http://www.cl.cam.ac.uk/~mgk25/iso-time.html : "In commercial and industrial applications (delivery times, production plans, etc.), especially in Europe, it is often required to refer to a week of a year. Week 01 of a year is per definition the first week that has the Thursday in this year, which is equivalent to the week that contains the fourth day of January. In other words, the first week of a new year is the week that has the majority of its days in the new year. Week 01 might also contain days from the previous year and the week before week 01 of a year is the last week (52 or 53) of the previous year even if it contains days from the new year. A week starts with Monday (day 1) and ends with Sunday (day 7). For example, the first week of the year 1997 lasts from 1996-12-30 to 1997-01-05 and can be written in standard notation as.." Previous Comments: ------------------------------------------------------------------------ [2003-07-16 12:08:50] s dot vanvelthem at ibelgique dot com Description: ------------ In PHP4.3.2, the function date('W', $timestamp) behaves differently from PHP4.2.3 concerning the ISO8601 dates For example (timestamps has been written in simple form for readablility), date('W', '2003-12-31') reports 1 in PHP4.3.2 (incorrect? Mysql returns the same result) reports 53 in PHP4.2.3 (should be the correct behaviour?) (ISO8601 weeks starting on Monday, so i think you could sometimes have a 53rd week in the year?). It's difficult to differenciate same week between years as date('Y-W', '2003-12-31') reports '2003-1' Sorry for my english, Thanks for your time. Seb Reproduce code: --------------- $timestamp = strtotime("2003-12-31"); echo date('Y-W', $timestamp); > outputs '2003-1' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24683&edit=1