2

I want to get all the working days of current week by ignoring weekends (Saturday and Sunday) also I want to ignore holidays as well (holiday list are in database)

Here is my code to get all the working days of current weeks (excluding Saturday and Sunday)

$holiday_date_list = []; // from database
$dt = new DateTime();
$dates = [];
for ($d = 1; $d <= 5; $d++)
{
$dt->setISODate($dt->format('o'), $dt->format('W'), $d);
$dates[$dt->format('D')] = $dt->format('Y-m-d');
}

foreach ($dates as $key => $value)
{
  echo $value . "<br>";
}

How can exclude holiday list from the above script?

Jake Symons
  • 468
  • 2
  • 10
  • 19
  • https://stackoverflow.com/questions/14907561/how-to-get-date-for-holidays-using-php – Sergo Pasoevi Dec 19 '17 at 12:37
  • Possible duplicate of [Excluding multiple values from the array](https://stackoverflow.com/questions/46622990/excluding-multiple-values-from-the-array) – julianstark999 Dec 19 '17 at 13:04
  • 1
    Possible duplicate of [How To Remove Duplicate Elements from array after merging with another array in php?](https://stackoverflow.com/questions/41310387/how-to-remove-duplicate-elements-from-array-after-merging-with-another-array-in) – mickmackusa Dec 20 '17 at 01:13

0 Answers0