note 97757 deleted from function.strtotime by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 06:49:16 +0000 |
| Subject: | note 97757 deleted from function.strtotime by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-196657@lists.php.net to get a copy of this message | ||
Note Submitter: support at esoweb dot eu
----
This an example of recurrence days.
This function return a recurrence day per week during a period.
Exemple: All Thurday starting from 06 May 2010 during 52 weeks.
<?php
//function
function nextWeeksDay($date_begin,$nbrweek)
{
$nextweek=array();
for($i = 1; $i <= $nbrweek; $i++) { // 52 week in one year of course
$nextweek[$i]=date('D d M Y', strtotime('+'.$i.' week',$date_begin));
}
return $nextweek;
}
/// end function
/// example of a select date
// var
$date_begin = strtotime('06-05-2010'); //D Day Month Year - like function format.
$nbrweek=52;
// call function
$result=nextWeeksDay($date_begin,$nbrweek);
// Preview
for($i = 1; $i <= $nbrweek; $i++) {
echo '<br> - '.$result[$i];
}
?>