Dear developer!
I found a script on the internet, by this script i can count leave days Like (2016-07-15) to (2016-07-22) without wekeend days. But i want count more records in one like (2016-07-15) to (2016-07-22) or (2015-01-11) to (2015-02-01).... I paste script on below please help me. Thank you.
<?php
$start = new DateTime('2016-07-15');
$end = new DateTime('2016-07-22');
// otherwise the end date is excluded (bug?)
$end->modify('+1 day');
$interval = $end->diff($start);
// total days
$days = $interval->days;
// create an iterateable period of date (P1D equates to 1 day)
$period = new DatePeriod($start, new DateInterval('P1D'), $end);
// best stored as array, so you can add more than one
$holidays = array('2016-07-22','2016-07-21');
foreach($period as $dt) {
$curr = $dt->format('D');
// for the updated question
if (in_array($dt->format('Y-m-d'), $holidays)) {
$days--;
}
// substract if Saturday or Sunday
if ($curr == 'Sat' || $curr == 'Sun') {
$days--;
}
}
echo $days; // 4
?>