note 85093 added to function.date-modify
| From: | ochojnackiATEMEgmail dot com at osu1 dot php dot net | Date: | Thu, 14 Aug 2008 12:49:49 +0000 |
| Subject: | note 85093 added to function.date-modify | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-143490@lists.php.net to get a copy of this message | ||
$cday - specified day of the week (0-6 where 0 is Sunday)
$currentDate - date of start
$endDate - date of end
We need dates of next couple of days, that day of week match defined.
<?php
if($currentDate->format('w')!= $cday){
switch ($cday){
case 0 : $cdays="Sunday"; break;
case 1 : $cdays="Monday"; break;
case 2 : $cdays="Tuesday"; break;
case 3 : $cdays="Wednesday"; break;
case 4 : $cdays="Thursday"; break;
case 5 : $cdays="Friday"; break;
case 6 : $cdays="Saturday";
}
date_modify($currentDate,"+1 {$cdays}");
}
while($currentDate < $endDate) {
echo $currentDate -> format('Y-m-d H:i:s');
$currentDate -> modify('+1 week');
}
?>
----
Server IP: 82.160.94.10
Probable Submitter: 193.239.58.253
----
Manual Page -- http://www.php.net/manual/en/function.date-modify.php
Edit -- https://master.php.net/note/edit/85093
Del: integrated -- https://master.php.net/note/delete/85093/integrated
Del: useless -- https://master.php.net/note/delete/85093/useless
Del: bad code -- https://master.php.net/note/delete/85093/bad+code
Del: spam -- https://master.php.net/note/delete/85093/spam
Del: non-english -- https://master.php.net/note/delete/85093/non-english
Del: in docs -- https://master.php.net/note/delete/85093/in+docs
Del: other reasons-- https://master.php.net/note/delete/85093
Reject -- https://master.php.net/note/reject/85093
Search -- https://master.php.net/manage/user-notes.php