Advertisement
Guest User

diferença entre minutos

a guest
Mar 26th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.35 KB | None | 0 0
  1. <?php
  2.  
  3. $data = json_decode('{"start": "22:51", "hora": "24:35"}');            
  4. //$data = json_decode('{"start": "22:51", "hora": "24:35"}', true);                
  5.  
  6. $start = strtotime($data->start);
  7. $hora = strtotime($data->hora);
  8. //$start = strtotime($data['start']);
  9. //$hora = strtotime($data['hora']);
  10.  
  11. print round(abs($start - $hora)/60, 2) .  " minutos";
  12.  
  13. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement