note 15438 added to function.time
| From: | hav0x at enteract dot com | Date: | Mon, 10 Sep 2001 17:52:25 +0000 |
| Subject: | note 15438 added to function.time | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-17884@lists.php.net to get a copy of this message | ||
To Caspar (re: find Mondays in a time period):
Use mktime() to set your start and stop dates for your scanning loop (have the stop date be one day
after your actual desired stop date).
Then use date() to match the day of the week with the timestamp loop.
Example:
for ($i=mktime(0,0,0,9,6,2001); $i<mktime(0,0,0,9,27,2001);)
{
if (date("w",$i) == 1)
{ echo date("mdy",$i)." is a Monday";}
$i = $i + 86400; // jump ahead to the next day
}
http://www.php.net/manual/en/function.time.php