Bug #63927 [Opn->Nab]: Bogus week number with date + strtotime
| From: | rasmus@php.net | Date: | Mon, 07 Jan 2013 09:22:54 +0000 |
| Subject: | Bug #63927 [Opn->Nab]: Bogus week number with date + strtotime | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-175810@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=63927&edit=1
ID: 63927
Updated by: rasmus@php.net
Reported by: tcheko at no-log dot org
Summary: Bogus week number with date + strtotime
-Status: Open
+Status: Not a bug
Type: Bug
Package: Date/time related
Operating System: Linux
PHP Version: 5.4.10
Block user comment: N
Private report: N
New Comment:
There is no bug here. This is correct as per the ISO-8601 Date spec. The first
week of the year is the week that contains the first Thursday. And weeks always
start on Mondays. That means the first day of the first week is not always in the
same calendar year as the first Thursday. Please read the ISO-8601 spec for more
details.
Previous Comments:
------------------------------------------------------------------------
[2013-01-07 09:06:49] tcheko at no-log dot org
Description:
------------
the test script returns date formated as year+week.
It should return a list of date like this:
...
201250
201251
201252
201301
201302
...
NB: increase $i if current weeknumber is greater than 14 to expose the bug.
Test script:
---------------
<?php
for($i = 15; $i >= 0; $i--) echo date("YW", strtotime("-$i week")) .
"<br />";
?>
Expected result:
----------------
...
201250
201251
201252
201301
201302
...
Actual result:
--------------
...
201250
201251
201252
**201201**
201302
...
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=63927&edit=1