|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-14 19:56 UTC] tony2001@php.net
[2005-11-17 13:13 UTC] derick@php.net
[2005-11-17 13:27 UTC] tony2001@php.net
[2005-11-23 19:00 UTC] mail at harendt dot de
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Jan 05 02:00:02 2026 UTC |
Description: ------------ The function "date" called with the parameter "W" to give the number of the week is wrong when thr year turns. For example the function give for sunday, 01.01.2006 the week number 52. Reproduce code: --------------- <?php $Dez05 = mktime(0, 0, 0, 12, 28, 2005); $aHour = 60*60; $aDay = $aHour * 24; for ($d = 0; $d <= 5; $d++) { $Day00 = $Dez05 + $d * $aDay; for ($ih = 0; $ih < 3; $ih++) { $h=8*$ih; $TS = $Day00 + $h * $aHour; $DAY = date("D",$TS); $nrDAY = date("d",$TS); $HR = date("H",$TS); $MIN = date("i",$TS); $MNTH = date("m",$TS); $YEAR = date("y",$TS); $WEEK = date("W",$TS); $WEEK = sprintf ("%02d", $WEEK); $sd = sprintf ("%02d", $d); $sh = sprintf ("%02d", $h); echo "$TS ($sd, $sh) --> week = <b>$WEEK</b>, $DAY, $nrDAY.$MNTH.$YEAR, $HR.$MIN </br>"; } } ?> Expected result: ---------------- 1135724400 (00, 00) --> week = 52, Wed, 28.12.05, 00.00 1135753200 (00, 08) --> week = 52, Wed, 28.12.05, 08.00 1135782000 (00, 16) --> week = 52, Wed, 28.12.05, 16.00 1135810800 (01, 00) --> week = 52, Thu, 29.12.05, 00.00 1135839600 (01, 08) --> week = 52, Thu, 29.12.05, 08.00 1135868400 (01, 16) --> week = 52, Thu, 29.12.05, 16.00 1135897200 (02, 00) --> week = 52, Fri, 30.12.05, 00.00 1135926000 (02, 08) --> week = 52, Fri, 30.12.05, 08.00 1135954800 (02, 16) --> week = 52, Fri, 30.12.05, 16.00 1135983600 (03, 00) --> week = 52, Sat, 31.12.05, 00.00 1136012400 (03, 08) --> week = 52, Sat, 31.12.05, 08.00 1136041200 (03, 16) --> week = 52, Sat, 31.12.05, 16.00 1136070000 (04, 00) --> week = 52, Sun, 01.01.06, 00.00 !! 1136098800 (04, 08) --> week = 52, Sun, 01.01.06, 08.00 !! 1136127600 (04, 16) --> week = 52, Sun, 01.01.06, 16.00 !! 1136156400 (05, 00) --> week = 01, Mon, 02.01.06, 00.00 1136185200 (05, 08) --> week = 01, Mon, 02.01.06, 08.00 1136214000 (05, 16) --> week = 01, Mon, 02.01.06, 16.00