Calculate No Of Days Excluding Weekends
Count the number of days between two dates that exclude weekends as non work days
Count the no.Of Days between to days Excluding Sunday
$start = strtotime('2013-04-01');
$end = strtotime('2013-04-7');
while ($start <= $end) {
if (date('N', $start) <= 6) {
$days++; }
$start += 86400;
}
echo $days;
Count the no.Of Days between to days Excluding Sunday and Saturday
$start = strtotime('2013-04-01');
$end = strtotime('2013-04-7');
while ($start <= $end) {
if (date('N', $start) <= 5) {
$days++; }
$start += 86400;
}
echo $days;
Count the number of days between two dates that exclude weekends as non work days
Count the no.Of Days between to days Excluding Sunday
$start = strtotime('2013-04-01');
$end = strtotime('2013-04-7');
while ($start <= $end) {
if (date('N', $start) <= 6) {
$days++; }
$start += 86400;
}
echo $days;
Count the no.Of Days between to days Excluding Sunday and Saturday
$start = strtotime('2013-04-01');
$end = strtotime('2013-04-7');
while ($start <= $end) {
if (date('N', $start) <= 5) {
$days++; }
$start += 86400;
}
echo $days;
No comments:
Post a Comment