note 66819 added to function.date
| From: | wmdonkers | Date: | Tue, 30 May 2006 11:07:20 +0000 |
| Subject: | note 66819 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-112534@lists.php.net to get a copy of this message | ||
Need all dates in a given week number? a fast solution.
function returns an array of dates in the format "d-m-Y".
suggestions and or comments are more then welcome.
<?php
function getdatesofweek($week)
{
$o = ($week-date("W"))*7;
$c = 8;
$df = "d-m-Y";
while($c>=0){
$td=mktime(12,0,0,date("m"),(date("d")-($c-$o)),date("Y"));
if(date("W",$td)==$week){
$datearray[]=date($df,$td);
}
$c--;
}
$c= 1;
while($c<9){
$td=mktime(12,0,0,date("m"),(date("d")+($c+$o)),date("Y"));
if(date("W",$td)==$week){
$datearray[]=date($df,$td);
}
$c++;
}
return $datearray;
}
?>
----
Server IP: 217.160.72.57
Probable Submitter: 80.140.108.181
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.date.php
Edit -- http://master.php.net/note/edit/66819
Del: integrated -- http://master.php.net/note/delete/66819/integrated
Del: useless -- http://master.php.net/note/delete/66819/useless
Del: bad code -- http://master.php.net/note/delete/66819/bad+code
Del: spam -- http://master.php.net/note/delete/66819/spam
Del: non-english -- http://master.php.net/note/delete/66819/non-english
Del: in docs -- http://master.php.net/note/delete/66819/in+docs
Del: other reasons-- http://master.php.net/note/delete/66819
Reject -- http://master.php.net/note/reject/66819
Search -- http://master.php.net/manage/user-notes.php