note 19354 added to function.strftime
| From: | elsni at NOSPAM dot elsni dot de | Date: | Mon, 25 Feb 2002 10:25:00 +0000 |
| Subject: | note 19354 added to function.strftime | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-27003@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];
}
--
http://www.php.net/manual/en/function.strftime.php
http://master.php.net/manage/user-notes.php?action=edit+19354
http://master.php.net/manage/user-notes.php?action=delete+19354
http://master.php.net/manage/user-notes.php?action=reject+19354