PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $date = date('Y-m-01'); $next_month = date('Y-m-d', strtotime('+1 month', strtotime($date))); function nextWorkDay($date) { $day_of_week = date('N', strtotime($date)); if ($day_of_week>5) { //echo "Weekend: " . $date; $shift = 8-$day_of_week; return date('Y-m-d', strtotime("+{$shift} day", strtotime($date))); } else { echo "Work day ($day_of_week):" . $date . PHP_EOL; return date('Y-m-d', strtotime('+3 day', strtotime($date))); } } while ($date < $next_month) { $date = nextWorkDay($date); }
Show:  
Copy Clear