note 19354 deleted from function.strftime by dams
| From: | dams@php.net | Date: | Mon, 05 Aug 2002 22:48:23 +0000 |
| Subject: | note 19354 deleted from function.strftime by dams | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-34341@lists.php.net to get a copy of this message | ||
With this function you can get the iso weeknumber on windows systems. The ISOWeek function by
martijnc is wrong in some cases (try to calculate the week number of 30. december 2002)
function isoweek($datum)
{
$jahr=uget($datum,"year");
$a = floor((uget($datum,"yday")+((uget(mktime
(0,0,0,1,1,$jahr),"wday")+2)%7)-3)/7)+1;
if ($a==0)
{
$a = isoweek(mktime (0, 0, 0, 12, 31, $jahr-1));
}
else if (($a==53) && ((uget(mktime (0, 0, 0, 12, 31,
$jahr),"wday")-1)%7)<= 3)
{
$a = 1;
}
return $a;
}
function uget($udate,$type)
{
$da=getdate($udate);
return $da[$type];
}