note 67269 added to function.date
| From: | BenSilverman at osu1 dot php dot net | Date: | Tue, 06 Jun 2006 18:22:42 +0000 |
| Subject: | note 67269 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-113369@lists.php.net to get a copy of this message | ||
Here is a riff derived from examples calculating business days, taking a MySQL datetime field and
adding $numDays business days to it...
//$mysqlDateStart = mysql-formatted datetime
//$numDays = business days ahead
function getBizDaysAhead($mysqlDateStart,$numDays) {
$startday = strtotime($mysqlDateStart);
for ($i=0;$i<$numDays;$i++) {
$dayOfWeek = strftime("%A", $startday + ($i * 86400));
if($dayOfWeek == "Saturday" || $dayOfWeek == "Sunday") {
$numDays++;
}
}
return(date("m/d/Y",$startday + ($numDays * 86400)));
}
----
Server IP: 66.163.161.117
Probable Submitter: 75.6.42.142
----
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/67269
Del: integrated -- http://master.php.net/note/delete/67269/integrated
Del: useless -- http://master.php.net/note/delete/67269/useless
Del: bad code -- http://master.php.net/note/delete/67269/bad+code
Del: spam -- http://master.php.net/note/delete/67269/spam
Del: non-english -- http://master.php.net/note/delete/67269/non-english
Del: in docs -- http://master.php.net/note/delete/67269/in+docs
Del: other reasons-- http://master.php.net/note/delete/67269
Reject -- http://master.php.net/note/reject/67269
Search -- http://master.php.net/manage/user-notes.php