I am trying to get the next 3 days using php but if the date is a weekend or a defined holiday I would like to skip that date.
For example if the date is Monday, December 23, 2013
My holiday dates are array('2013-12-24', '2013-12-25');
The script would return
Monday, December 23, 2013
Thursday, December 26, 2013
Friday, December 27, 2013
Monday, December 30, 2013
Her is my current code:
$arr_date = explode('-', '2013-12-23');
$counter = 0;
for ($iLoop = 0; $iLoop < 4; $iLoop++)
{
$dayOfTheWeek = date("N", mktime(0, 0, 0, $arr_date[1], $arr_date[2]+$counter, $arr_date[0]));
if ($dayOfTheWeek == 6) { $counter += 2; }
$date = date("Y-m-d", mktime(0, 0, 0, $arr_date[1], $arr_date[2]+$counter, $arr_date[0]));
echo $date;
$counter++;
}
The issue I am having is I am not sure to how to even go about excluding holidays dates.
23
– Robert E. McIntosh