Bug #18532 Updated: date('W'...) returns wrong weeknumbers

From: Date: Wed, 24 Jul 2002 18:57:13 +0000
Subject: Bug #18532 Updated: date('W'...) returns wrong weeknumbers
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-15074@lists.php.net to get a copy of this message
ID: 18532 Updated by: tmus@get2net.dk Reported By: tmus@get2net.dk -Status: Bogus +Status: Open Bug Type: Date/time related Operating System: Linux / Windows XP PHP Version: 4.2.1 New Comment: I'm sorry, but did you read my bug report before closing it as bogus..? it returns Week 53 for TUESDAY 31 Dec. and Week 1 for the day AFTER that - This is incorrect!!! The way I read the ISO date specification, it is NOT possible for the same week MON-SUN to have two different week numbers!!! And the ISO specifies that a WEEK is STARTING on monday and ENDING on sunday, so howcome the weeknumber changes between Tuesday and Wednesday... Please just try the code i sent you guys! Previous Comments: ------------------------------------------------------------------------ [2002-07-24 12:36:19] georg@php.net date uses iso8601 standard which supports long years (53 weeks). the first week of the ISO calendar year can begin as late as 4 January and as early as 29 December of the previous year. Likewise, the last week of the ISO calendar year can end as early as 28 December and as late as 3 January of the following year. ------------------------------------------------------------------------ [2002-07-24 05:07:50] tmus@get2net.dk There is a problem with the date('W'...) function in PHP 4.2.1... The ISO standard says that week 1 is the week that has the first thursday of the gregorian year, making the last week the week with the last thursday of the year (more/better info here http://www.merlyn.demon.co.uk/weekinfo.htm#WkNo ) But anyway, try making the following test... print date("r (W)",1041289200)."<br>\n"; // Tue, 31 Dec 2002 00:00:00 +0100 (53) print date("r (W)",1041375600)."<br>\n"; // Wed, 1 Jan 2003 00:00:00 +0100 (1) So any way You decide to put it, at least the same week should not have two different numbers depending on the timestamp. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=18532&edit=1

« previous php.bugs (#15074) next »