This is the easiest code I could come up with. You really need to create an array or a database table in order to spend the holidays in order to get the true “Working days” score, but that wasn’t what was set, so here you go, hope this helps someone.
function get_weekdays($m,$y) { $lastday = date("t",mktime(0,0,0,$m,1,$y)); $weekdays=0; for($d=1;$d<=$lastday;$d++) { $wd = date("w",mktime(0,0,0,$m,$d,$y)); if($wd > 0 && $wd < 6) $weekdays++; } return $weekdays; }
Rkaneknight
source share