Good morning, I am trying to create a code where I can tell how many days and hours on a date range are shown separately. type this:
Start time = 12:07:07 - Start Date = 10/15/2018 - Final Time = 12:07:08 - Final Date = 10/16/2018 - TEMPO = 24:00:01 - TOTAL DAYS = 01
Can anyone help me? I already tried everything I knew, I searched the internet and I was able to adapt to a code that only showed the range of hours, but I wanted to improve it to show the interval between the dates too.
follow the code below
$entrada = $row_pesquisar['horainicio'];
$saida = $row_pesquisar['horafinal'];
$row_pesquisar1['horainicio'] = explode(":",$entrada);
$row_pesquisar1['horafinal'] = explode(":",$saida);
$acumulador1 = ($row_pesquisar1['horainicio'][0] * 3600) + ($row_pesquisar1['horainicio'][1] * 60) + $row_pesquisar1['horainicio'][2];
$acumulador2 = ($row_pesquisar1['horafinal'][0] * 3600) + ($row_pesquisar1['horafinal'][1] * 60) + $row_pesquisar1['horafinal'][2];
$resultado = $acumulador2 - $acumulador1;
$hora_ponto = floor($resultado / 3600);
$resultado = $resultado - ($hora_ponto * 3600);
$min_ponto = floor($resultado / 60);
$resultado = $resultado - ($min_ponto * 60);
$secs_ponto = $resultado;
$tempo = $hora_ponto.":".$min_ponto.":".$secs_ponto;
echo $tempo;