Get Next Working Date, skip weekends and holidays The object is to be able to pass some dates (start date, holiday) and the number of days you want to skip. We only want to skip working days, not weekends and holidays. 

Just let me know what you'd do different than what I have. The code works, but I was told there are issues with it, but not told what issues they are.

function getWDays($startDate,$holiday,$wDays){

$d = new DateTime( $startDate );
$t = $d-&gt;getTimestamp();
$h = strtotime($holiday);

// loop for $wDays days
for($i=0; $i&lt;$wDays; $i++){

    // 1 day = 86400 seconds
    $addDay = 86400;

    $nextDay = date('w', ($t+$addDay));
    if($nextDay == 0 || $nextDay == 6) {
        $i--;
    }
    $t = $t+$addDay;
    if ($t == $h) {
        // lets make sure the holiday isn't one of our weekends
        if(!$nextDay == 0 || !$nextDay == 6) {
            $t = $t+$addDay;    
        }
    }
}

$d-&gt;setTimestamp($t);


return $d-&gt;format( 'Y-m-d' );

}

echo getWDays("2013-08-29","2013-09-02", 3)
Here is another way of doing the same thing

&lt;?php

function getWDays($startDate,$holiday,$wDays) {

    // using + weekdays excludes weekends
    $new_date = date('Y-m-d', strtotime("{$startDate} +{$wDays} weekdays"));

    $holiday_ts = strtotime($holiday);

    // if holiday falls between start date and new date, then account for it
    if ($holiday_ts &gt;= strtotime($startDate) &amp;&amp; $holiday_ts &lt;= strtotime($new_date)) {

        // check if the holiday falls on a working day
        $h = date('w', $holiday_ts);
            if ($h != 0 &amp;&amp; $h != 6 ) {
            // holiday falls on a working day, add an extra working day
            $new_date = date('Y-m-d', strtotime("{$new_date} + 1 weekdays"));
        }
    }

    return $new_date;
}

// here is an example
$start = "2013-08-29";
$holiday = "2013-09-02";
$wDays = 3;

echo "Start: ",date("Y-m-d D", strtotime($start)),"&lt;br /&gt;";
echo "Holiday: ",date("Y-m-d D", strtotime($holiday)),"&lt;br /&gt;";
echo "WDays: $wDays&lt;br /&gt;";

echo getWDays($start, $holiday, $wDays);