Guest User

Untitled

a guest
Jun 24th, 2018
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. $start = "12:00";
  2. $end = "03:00";
  3.  
  4. $startUnix = strtotime(date('Y-m-d') ." ". $start);
  5. $endUnix = strtotime(date('Y-m-d') ." ". $end);
  6.  
  7. $time = $endUnix - $startUnix;
  8. if($time < 0){
  9.  
  10. $endUnix += 86400;
  11. $time = $endUnix - $startUnix;
  12. echo "Часов: ".$time/(60*60); //Напишет, что между времеными метками 15 часов(след. день)
  13.  
  14. } else {
  15.  
  16. echo "Часов: ".$time/(60*60);
  17.  
  18. }
Add Comment
Please, Sign In to add comment