src/Panda/Support/Helpers/DateTimeHelper.php
public static function getWorkingDaysCount($beginDate, $endDate, $nonWorkingDays = [])
    {
        $workdays = 0;
        if (!is_null($beginDate) && !is_null($endDate)) {
            if ($beginDate > $endDate) {
                $temp = $beginDate;
                $beginDate = $endDate;
                $endDate = $temp;
            }
            $oneDayInterval = new DateInterval('P1D');
            $date = clone $beginDate;
            while (self::compareDateWithoutTime($date, $endDate) <= 0) {
                $weekday = $date->format('N');
                if (!in_array($weekday, $nonWorkingDays)) {
                    $workdays++;
                }
                $date->add($oneDayInterval);
            }
        }

        return $workdays;
    }
public static function getWorkingDaysCount($beginDate, $endDate, $nonWorkingDays = [])
    {
        $workdays = 0;
        if (!is_null($beginDate) && !is_null($endDate)) {
            if ($beginDate > $endDate) {
                $temp = $beginDate;
                $beginDate = $endDate;
                $endDate = $temp;
            }
            $oneDayInterval = new DateInterval('P1D');
            $date = clone $beginDate;
            while (self::compareDateWithoutTime($date, $endDate) <= 0) {
                $weekday = $date->format('N');
                if (!in_array($weekday, $nonWorkingDays)) {
                    $workdays++;
                }
                $date->add($oneDayInterval);
            }
        }

        return $workdays;
    }
public static function getWorkingDaysCount ( $ beginDate , $ endDate , $ nonWorkingDays = [ ] ) { $ workdays = 0 ; if ( ! is_null ( $ beginDate ) && ! is_null ( $ endDate ) ) { if ( $ beginDate > $ endDate ) { $ temp = $ beginDate ; $ beginDate = $ endDate ; $ endDate = $ temp ; } $ oneDayInterval = new DateInterval ( 'P1D' ) ; $ date = clone $ beginDate ; while ( self :: compareDateWithoutTime ( $ date , $ endDate ) <= 0 ) { $ weekday = $ date -> format ( 'N' ) ; if ( ! in_array ( $ weekday , $ nonWorkingDays ) ) { $ workdays ++ ; } $ date -> add ( $ oneDayInterval ) ; } } return $ workdays ; }
Count working days between the two given dates.
The comparison includes both begin and end dates.

@param DateTime $beginDate
@param DateTime $endDate
@param int[]    $nonWorkingDays array containing the non working days (i.e. [6,7] for Saturday and Sunday)

@return int Number of working days
Count working days between the two given dates . The comparison includes both begin and end dates .