Hello, I have an application so that a user can take vacation days. I have a function that does not tell me neither weekend nor holidays. For example in Andalusia on March 29 is a holiday, if a user takes a vacation from March 28 to April 2, it will come out that he has taken 3 days of vacation because he has not counted either the holiday or the end of week. So far so good. My problem comes when I select nothing more than March 29. If I put that day's holidays only and choose March 29 at 08:00 until March 29 at 5:00 p.m., tell me that day as 1 instead of telling it as 0. Any help? Here I leave my function:
function diashabiles($fechainicio, $fechafin){
$inicio = strtotime($fechainicio);
$final = strtotime($fechafin);
$dias = 0;
$sql = "SELECT COUNT(*) FROM fechas as f join calendarios as c on c.PK_CALENDARIOS = f.FK_CALENDARIO join sec_users as u on u.fk_zona = c.PK_CALENDARIOS WHERE u.login = 'user1' AND f.FECHA_ZONA between '".$fechainicio."' AND '".$fechafin."'";
sc_lookup(rr, $sql);
while(date('Y-m-d', $inicio) <= date('Y-m-d', $final)){
$dias += date('N', $inicio) < 6 ? 1 : 0;
$inicio = strtotime("+1 day", $inicio);
}
$dias -= {rr[0][0]};
return $dias;
}