ID: 34304 Updated by: [EMAIL PROTECTED] Reported By: sandved at gmail dot com -Status: Assigned +Status: Closed Bug Type: Feature/Change Request Operating System: * PHP Version: 6CVS, 5CVS, 4CVS Assigned To: derick New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Fixed for PHP 5.1 and 6 by adding the "N" modifier. Previous Comments: ------------------------------------------------------------------------ [2005-08-30 16:23:55] [EMAIL PROTECTED] Yeah, but it's not a bug but missing feature. ------------------------------------------------------------------------ [2005-08-30 12:42:22] sandved at gmail dot com Is it possible then to add a (ISO day) parameter which return 1 for monday, 2 for tuesday, ..., 6 for saturday and 7 for sunday? ------------------------------------------------------------------------ [2005-08-30 12:28:11] [EMAIL PROTECTED] It's returning what it's documented to return. (it is not some ISO standard it complies to but the PHP manual) ------------------------------------------------------------------------ [2005-08-30 12:11:25] sandved at gmail dot com Description: ------------ The Date function have a day of the week parameter 'w' This parameter should return 7 for sundays, not 0 to be ISO 8601 compilant Why http://se.php.net/date : > w Numeric representation of the day of the week > 0 (for Sunday) through 6 (for Saturday) This week parameter do not return leading zeros when used like Date('o\WWw'), Date('o\-\WW\-w') According to ISO 8601 monday is the first day of the week and sunday the last, numbereded 1 to 7 (Section 5.2.3 Week date states In expressions of week dates - day of the week is represented by one decimal digit. Monday shall be identified as day [1] of any calendar week, and subsequent days of the same week shall be numbered in ascending sequence to Sunday (day [7]).) like: Date - Week (extended format YYYY-Www-D) ---------- - ---------- 1997-12-29 - 1998-W01-1 1998-01-04 - 1998-W01-7 1998-01-01 - 1998-W01-4 1998-12-31 - 1998-W53-4 1992-01-01 - 1992-W01-3 1992-02-29 - 1992-W09-6 1992-12-31 - 1992-W53-4 1975-01-01 - 1975-W01-3 1975-12-28 - 1975-W52-7 1975-12-29 - 1976-W01-1 Sources Here's a copy of the latest free online copy http://www.pvv.org/~nsaa/8601v2000.pdf, only minor changes in the text in the latest version from ISO - also see http://en.wikipedia.org/wiki/ISO_8601. Reproduce code: --------------- Echo Date('o\-\WW\-w', strtotime('2 January 2005')) Date('o\-\WW\-w', strtotime('9 January 2005')); Expected result: ---------------- 2004-W53-7 2005-W01-7 Actual result: -------------- 2004-W53-0 2005-W1-0 (leading zeros in week fixed in bug report http://bugs.php.net/?id=34302) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=34304&edit=1