 <pre><code>$numdays = cal_days_in_month (CAL_GREGORIAN, $mon,$yr); for($i=1;$i&lt;=$numdays;$i++) { if(date('N',strtotime($y.'-'.$m.'-'.$i))==7) $sun++; } </code></pre> <p>Sunday calculation after u calculate employee working days </p> <pre><code>$tot=$numdays-$sun-$emp_working_days;echo $tot; </code></pre>