Answers for "php count days excluding weekends"

PHP
0

php count days excluding weekends

function sumDays($days = 0, $format = 'd/m/Y') {
    $incrementing = $days > 0;
    $days         = abs($days);
    $actualDate   = date('Y-m-d');

    while ($days > 0) {
        $tsDate    = strtotime($actualDate . ' ' . ($incrementing ? '+' : '-') . ' 1 days');
        $actualDate = date('Y-m-d', $tsDate);

        if (date('N', $tsDate) < 6) {
            $days--;
        }
    }

    return date($format, strtotime($actualDate));
}
Posted by: Guest on May-17-2021

Code answers related to "php count days excluding weekends"

Browse Popular Code Answers by Language