[EMAIL PROTECTED] wrote:
I am trying to add 3 (or a user-defined amount) week days to a certain date.. An example is today 2005-08-18 then adding 3 week days to give me a date of 2005-08-23. I have tried searching online but cannot find an easy way of doing so.

$numDaysToAdd = 3;
$s = ($numDaysToAdd == 1) ? '' : 's';

$dayInFuture = strtotime("+$numDaysToAdd day$s");
$dayName = date('l', $dayInFuture);
if($dayName == 'Saturday') {
        $dayInFuture = strtotime("+2 days", $dayInFuture);
} else if($dayName == 'Sunday') {
        $dayInFuture = strtotime("+1 day", $dayInFuture);
}

Disclaimer: untested code.

Jasper

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to