I have done this function so that I have as a result the working days without counting the weekend between two dates, in the database I have the date fields as DATATIME, but at the time of executing I get this error:
A non well formed numeric value encountered
The function is as follows:
function diashabiles ($fecha_inicio, $fecha_fin) {
list ($year, $month, $day) = explode ("/", $fecha_inicio);
$ini = mktime (0, 0, 0, $month, $day, $year);
list ($yearf, $mesf, $diaf) = explode ("/", $fecha_fin);
$fin = mktime (0, 0, 0, $mesf, $diaf, $yearf);
$newArray = array ();
$r = 1; $i = 0; $dia2 = 0;
while ($ini! = $fin) {
$ini = mktime (0, 0, 0, $month, $day + $r, $year);
$newArray [$i] = $ini;
$r++; $i++;
}
for ($i = 0; $i <count($newArray); $i++) {
$day = $newArray [$i];
$date = getdate($day);
if ($date["wday"] == 0 or $date["wday"] == 6) {
$dia2++;
}
}
$rlt = count($newArray) - $dia2;
return $rlt;
}
Thank You!!