How to calculate the time that the person entered and the time that the person left less the interval and display the total hours he gave?
For example if a guy made the following hours: 07:30 12:00 13:30 17:00 would have to display: 8 hours worked . It's just that I have to calculate several days in the same image and add up all the totals of hours I gave and display the result.
Columns in the bank:
bookmarks
id (int)
day (date) "date of time"
type (char) E (input) or S (output)
time (time) "are the schedules"
collaborator_id (int)
I have the following sql query:
$sql= mysql_query("SELECT dia, GROUP_CONCAT(hora) FROM marcacoes WHERE colaborador_id = {$colaborador_id} AND dia between '{$periodoInicial}' and '{$periodoFinal}' GROUP BY dia ");
The display is done through the code in php:
while($exibe = mysql_fetch_assoc($sql)){
$tabela ='<tbody>';
$tabela .='<tr>';
$tabela .='<td>'.date("d-m-Y", strtotime($exibe['dia'])).'</td>';
$tabela .='<td>'.$exibe['GROUP_CONCAT(hora)'].'</a>'.'</td>';
$tabela .='</tr>';
$tabela .='</tbody>';
echo $tabela;
}
Thank you in advance.