php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21717 Bug in the function date("W");
Submitted: 2003-01-17 18:00 UTC Modified: 2003-01-17 19:44 UTC
From: christian dot grandsjo at home dot se Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 4.3.0 OS: Windows XP SP1 Swedish
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: christian dot grandsjo at home dot se
New email:
PHP Version: OS:

 

 [2003-01-17 18:00 UTC] christian dot grandsjo at home dot 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.

Patches

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-17 19:44 UTC] georg@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 07 23:01:27 2024 UTC