Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. <?php
  2. function calculohoras($hora_inicio, $hora_final){
  3. $datetime1 = new DateTime($hora_inicio);
  4. $datetime2 = new DateTime($hora_final);
  5. $interval = $datetime1->diff($datetime2);
  6. return $interval->format('%H:%I');
  7. }
  8.  
  9. $horas = calculohoras("2019-05-21 08:00:00", "2019-05-21 17:30:00");
  10. $pausa = calculohoras("2019-05-21 13:30:00", "2019-05-21 14:30:00");
  11.  
  12. $total = $horas - $pausa;
  13.  
  14. echo $total;
  15. ?>
  16.  
  17. Notice: A non well formed numeric value encountered
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement