Post

2 followers Follow
0
Avatar

Count the number of working days in Globiflow

How do you count working days between two dates in Globiflow?

Some php functions not allowed eg while!

System Admin

Please sign in to leave a comment.

1 comment

0
Avatar

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
Rainer Grabowski 0 votes
Comment actions Permalink