[ create a new paste ] login | about

Link: http://codepad.org/cQ2RB5Gg    [ raw code | output | fork ]

PHP, pasted on Jul 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
$time1 = "today 23:45";
$time2 = "tomorrow 01:24";

$diff = abs(strtotime($time1) - strtotime($time2));

$tmins = $diff/60;

$hours = floor($tmins/60);

$mins = $tmins%60;


echo "<b>$hours</b> hours and<b>$mins</b> minutes</b>";
?>


Output:
1
<b>1</b> hours and<b>39</b> minutes</b>


Create a new paste based on this one


Comments: