Comments

1 comment

  • Rainer Grabowski

    Hi,

    This code (in a custom variable) should work.
     
    foo(); function foo() {
    $start = [your start date field];
    $end = [your end date field];
    $workdays = 0;
    $days = intval(strtotime($end) - strtotime($start))/(60 * 60 * 24);
        for($i = 0; $i <= $days; $i++){
             if(date("N",strtotime($start." + ".$i." days")) < 6){
                $workdays += 1;     
            }
       }
    return $workdays;  
    };

    The code counts each weekday except Sat. and Sun. (Sat. = weekday 6, Sun. = weekday 7)
     
    Rainer
    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk