note 27821 deleted from function.strftime by sniper
| From: | sniper@php.net | Date: | Wed, 15 Jan 2003 09:34:41 +0000 |
| Subject: | note 27821 deleted from function.strftime by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-42159@lists.php.net to get a copy of this message | ||
I have found out a way to make a function that should work to find out which week number a specific
date bellongs to:
function ISOWeek($y, $m, $d)
{
$week=strftime("%W", mktime(0, 0, 0, $m, $d, $y));
$dow0101=getdate(mktime(0, 0, 0, 1, 1, $y));
if ($dow0101["wday"]>1 && $dow0101["wday"]<5)
$week++;
elseif ($week==0)
$week=ISOWeek($y-1,12,31);
if ($week==53 && $m==12)
$week=ISOWeek($y+1,1,1);
return(substr("00" . $week, -2));
}
(This is just an adjustment of a previous script)