src/DateTimeUtil.php
public static function getNextBusinessDay($datetime, $holidays = array())
    {
        $dateParts = self::getdate($datetime);
        // Add 1 day to begin with
        $ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+1, $dateParts['year']);
        $goodDate = false;
        while (!$goodDate) {
            $dateParts = \getdate($ts);
            if ($dateParts['weekday'] == 'Saturday') {
                // Add 2 days
                $ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+2, $dateParts['year']);
            } elseif ($dateParts['weekday'] == 'Sunday') {
                // Add 1 day
                $ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+1, $dateParts['year']);
            } elseif (\in_array(\date('Ymd', $ts), $holidays)) {
                // Add 1 day
                $ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+1, $dateParts['year']);
            } else {
                $goodDate = true;
            }
        }
        return self::getDateTime($ts);
    }
public static function getNextBusinessDay($datetime, $holidays = array())
    {
        $dateParts = self::getdate($datetime);
        // Add 1 day to begin with
        $ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+1, $dateParts['year']);
        $goodDate = false;
        while (!$goodDate) {
            $dateParts = \getdate($ts);
            if ($dateParts['weekday'] == 'Saturday') {
                // Add 2 days
                $ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+2, $dateParts['year']);
            } elseif ($dateParts['weekday'] == 'Sunday') {
                // Add 1 day
                $ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+1, $dateParts['year']);
            } elseif (\in_array(\date('Ymd', $ts), $holidays)) {
                // Add 1 day
                $ts = \mktime(0, 0, 0, $dateParts['mon'], $dateParts['mday']+1, $dateParts['year']);
            } else {
                $goodDate = true;
            }
        }
        return self::getDateTime($ts);
    }
public static function getNextBusinessDay ( $ datetime , $ holidays = array ( ) ) { $ dateParts = self :: getdate ( $ datetime ) ; // Add 1 day to begin with $ ts = \ mktime ( 0 , 0 , 0 , $ dateParts [ 'mon' ] , $ dateParts [ 'mday' ] + 1 , $ dateParts [ 'year' ] ) ; $ goodDate = false ; while ( ! $ goodDate ) { $ dateParts = \ getdate ( $ ts ) ; if ( $ dateParts [ 'weekday' ] == 'Saturday' ) { // Add 2 days $ ts = \ mktime ( 0 , 0 , 0 , $ dateParts [ 'mon' ] , $ dateParts [ 'mday' ] + 2 , $ dateParts [ 'year' ] ) ; } elseif ( $ dateParts [ 'weekday' ] == 'Sunday' ) { // Add 1 day $ ts = \ mktime ( 0 , 0 , 0 , $ dateParts [ 'mon' ] , $ dateParts [ 'mday' ] + 1 , $ dateParts [ 'year' ] ) ; } elseif ( \ in_array ( \ date ( 'Ymd' , $ ts ) , $ holidays ) ) { // Add 1 day $ ts = \ mktime ( 0 , 0 , 0 , $ dateParts [ 'mon' ] , $ dateParts [ 'mday' ] + 1 , $ dateParts [ 'year' ] ) ; } else { $ goodDate = true ; } } return self :: getDateTime ( $ ts ) ; }
Given passed datetime return DateTime of next business day

@param mixed $datetime DateTime, string, or timestamp
@param array $holidays array()   Optional array of dates (formatted yyyymmdd) that will be skipped

@return DateTime
Given passed datetime return DateTime of next business day