#34302 [Opn->Asn]: Date('W') do not return leading zeros for week 1 to 9 (as specified in ISO)
| From: | derick@php.net | Date: | Tue, 30 Aug 2005 09:10:42 +0000 |
| Subject: | #34302 [Opn->Asn]: Date('W') do not return leading zeros for week 1 to 9 (as specified in ISO) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-84171@lists.php.net to get a copy of this message | ||
ID: 34302
Updated by: derick@php.net
Reported By: sandved at gmail dot com
-Status: Open
+Status: Assigned
Bug Type: Date/time related
Operating System: all
PHP Version: 5.0.4
-Assigned To:
+Assigned To: derick
Previous Comments:
------------------------------------------------------------------------
[2005-08-30 11:05:24] sandved at gmail dot com
Description:
------------
The Date function have an ISO compilant Week parameter 'W'
This parameter should return leading zeros for week 1 to 9 (always
returning 2 digits).
Why
http://se.php.net/date :
> W ISO-8601 week number of year, weeks starting on Monday
> (added in PHP 4.1.0)
This week parameter do not return leading zeros when used like
Date('W'), Date('o\WW') etc. for the weeks 1 to 9
According to ISO 8601 weeks should be represented with leading zeros
(from section 4.8 Leading zeros
Each date and time component in a defined representation has a defined
length, and leading zeros shall be used as
required.) like:
Date - Week (extended format)
---------- - ----------
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('W',strtotime('4 January 1999'));
Expected result:
----------------
01
Actual result:
--------------
1
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34302&edit=1