php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20363 Wrong week number
Submitted: 2002-11-11 09:14 UTC Modified: 2002-11-12 07:35 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: agnermadsen at hotmail dot com Assigned:
Status: Closed Package: Calendar related
PHP Version: 4.2.3 OS: windows 2000
Private report: No CVE-ID: None
 [2002-11-11 09:14 UTC] agnermadsen at hotmail dot com
Wrong weeknumber is reportet for year=2001, month=12, day 31. The date function reports that is week number 53, but it is really week number 1. I fear that there are more bugs related to this problem.


**** script start ****
$date1=mktime(0,0,0,1,1,2002);
$dag=date("w",$date1);
if ($dag<=4) { 
     echo $date1." is week 1";
     $date2=mktime(0,0,0,1,1-$dag+1,2002);
     echo "<br>";
     echo date ("Ymd-W", $date2);
     echo "<br>";
     echo date ("Ymd-W", $date1);
     echo "<br>";
}
**** script end ****
**** output start ****
1009839600 is week 1
20011231-53
20020101-1
**** output end ****


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-11 09:51 UTC] sniper@php.net
Works fine with latest CVS (on linux).

 [2002-11-11 09:53 UTC] derick@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, 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/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.
 [2002-11-11 09:54 UTC] derick@php.net
sorry, wrong report...
 [2002-11-12 04:58 UTC] agnermadsen at hotmail dot com
the problem exist in 4.2.3 too
 [2002-11-12 06:19 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip


 [2002-11-12 07:35 UTC] agnermadsen at hotmail dot com
Works in php version 4.3-dev (pre-release)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 20:01:29 2024 UTC