note 27119 rejected from function.date by rioter
| From: | rioter@php.net | Date: | Sat, 26 Jul 2003 14:21:47 +0000 |
| Subject: | note 27119 rejected from function.date by rioter | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-52706@lists.php.net to get a copy of this message | ||
Note Submitter: ditisprive@hotmail.com
----
Weeknumber-->date
This is a function to get the date if you know the week number of the year, so saturday/week 52/2002
gives 12.28.02.....
Function weektodate($weekcount,$weekdayname,$year)
{
$mydateformat="m.d.y";
$weeknr=0;
$theweekday=strtotime("last $weekdayname",mktime(0,0,0,1,1,$year));
Do{
$theweekday=strtotime("next $weekdayname",strtotime("+1 day",$theweekday));
$weeknr=date("W",$theweekday);
}while($weeknr<>$weekcount);
return date($mydateformat,$theweekday);
}
It is not the fastest one. Does anybody know a faster one?? Making a real calculation, with a matrix
or something is faster... Or a buildin function!