Hi already i'm using this code from another question - which adds two extra days to endday in the case of weekends
function add_business_days($startdate,$buisnessdays,$holidays,$dateformat){
$i=1;
$dayx = strtotime($startdate);
while($i < $buisnessdays){
$day = date('N',$dayx);
$datex = date('Y-m-d',$dayx);
if($day < 6 && !in_array($datex,$holidays))$i++;
$dayx = strtotime($datex.' +1 day');
}
return date($dateformat,$dayx);
}
This function forms part of a json output which is displayed in a jquery calendar - it picks up startdate and enddate and renders it.
Is it possible to create a code that returns outputs such that when it gets to a weekend it creates an end date, skips to Monday creates a start date then continues till it reaches the original given enddate??
x = date('w');
if (x != 6) {
while (x != 6) {
//start adding days to start date
}
} else {
//create new enddate = current iteration of dates currentdate;
//then new start (add two days to it to get to monday) currentdate + 2 = newstartdate
//redo above till you get to original end date