I need to calculate 14 working days after a given date.
I found this on php.net:
<?php
$holidayList = array("04-03-2008","07-03-2008");
$j = $i = 1;
///changed to 14
while($i <= 5)
///it didn't work
{
$day = strftime("%A",strtotime("+$j day"));
$tmp = strftime("%d-%m-%Y",strtotime("+$j day"));
if($day != "Sunday" and $day != "Saturday" and !in_array($tmp, $holidayList))
{
$i = $i + 1;
$j = $j + 1;
}
else
$j = $j + 1;
}
$j = $j -1;
echo strftime("%A, %d-%m-%Y",strtotime("+$j day"));
?>
The author designed it to calculate 5 working days. When I change the 5 to 14 it calculates 22 working days.