#21717 [Opn->Bgs]: Bug in the function date("W");
| From: | georg@php.net | Date: | Sat, 18 Jan 2003 01:44:12 +0000 |
| Subject: | #21717 [Opn->Bgs]: Bug in the function date("W"); | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-30405@lists.php.net to get a copy of this message | ||
ID: 21717
Updated by: georg@php.net
Reported By: christian.grandsjo@home.se
-Status: Open
+Status: Bogus
Bug Type: Date/time related
Operating System: Windows XP SP1 Swedish
PHP Version: 4.3.0
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
date("W") returns iso 8601 week number
Previous Comments:
------------------------------------------------------------------------
[2003-01-17 18:00:00] christian.grandsjo@home.se
<?php
for ($y = 0; $y <= 2050; $y++) {
$m = 12;
$d = 31;
$w = date("W", mktime(1, 1, 1, $m, $d, $y));
if ($w > 52) { echo "$y-$m-$d -> week: $w <br>"; }
}
?>
Will output:
4-12-31 -> week: 53
9-12-31 -> week: 53
15-12-31 -> week: 53
20-12-31 -> week: 53
26-12-31 -> week: 53
32-12-31 -> week: 53
37-12-31 -> week: 53
70-12-31 -> week: 53
76-12-31 -> week: 53
81-12-31 -> week: 53
87-12-31 -> week: 53
92-12-31 -> week: 53
98-12-31 -> week: 53
104-12-31 -> week: 53
109-12-31 -> week: 53
115-12-31 -> week: 53
120-12-31 -> week: 53
126-12-31 -> week: 53
132-12-31 -> week: 53
137-12-31 -> week: 53
1970-12-31 -> week: 53
1976-12-31 -> week: 53
1981-12-31 -> week: 53
1987-12-31 -> week: 53
1992-12-31 -> week: 53
1998-12-31 -> week: 53
2004-12-31 -> week: 53
2009-12-31 -> week: 53
2015-12-31 -> week: 53
2020-12-31 -> week: 53
2026-12-31 -> week: 53
2032-12-31 -> week: 53
2037-12-31 -> week: 53
Which is wrong because it should utput week: 1 :)
I think this information should be enough.
Good Luck :)
//Christian.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=21717&edit=1