Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function calculohoras($hora_inicio, $hora_final){
- $datetime1 = new DateTime($hora_inicio);
- $datetime2 = new DateTime($hora_final);
- $interval = $datetime1->diff($datetime2);
- return $interval->format('%H:%I');
- }
- $horas = calculohoras("2019-05-21 08:00:00", "2019-05-21 17:30:00");
- $pausa = calculohoras("2019-05-21 13:30:00", "2019-05-21 14:30:00");
- $total = $horas - $pausa;
- echo $total;
- ?>
- Notice: A non well formed numeric value encountered
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement