note 14447 added to function.date.php
| From: | mgs514 at lycos dot com | Date: | Tue, 31 Jul 2001 20:12:42 +0000 |
| Subject: | note 14447 added to function.date.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16132@lists.php.net to get a copy of this message | ||
This will return all dates for given days of the week between two dates;
//days to test
$day1="Monday";
$day2="Tuesday";
// begin &end of period :
$mydate="31/07/2001";
$newsplit = explode("/", $mydate);
$dat1=mktime(0,0,0,$newsplit[1],$newsplit[0],$newsplit[2]);
$mydate="29/10/2001";
$newsplit = explode("/", $mydate);
$dat2=mktime(0,0,0,$newsplit[1],$newsplit[0],$newsplit[2]);
print ("<select>");
$datc=$dat1;
while ($datc<=$dat2){
$datw=date("d/m/Y",$datc);
$jour=date ("l", $datc);
if ($day1==$jour || $day2==$jour){
print ("<option value=\"");
print ($datw);
print ("\">");
print ($jour);
print (" " . date("d-m-Y",$datc));
print ("</option>");
}
$datc=$datc + 86400;
}
print ("</select>");
http://www.php.net/manual/en/function.date.php