$time1 = '12:58';
$time2 = '15:00';
list($hours, $minutes) = explode(':', $time1);
$startTimestamp = mktime($hours, $minutes);
list($hours, $minutes) = explode(':', $time2);
$endTimestamp = mktime($hours, $minutes);
$seconds = $endTimestamp - $startTimestamp;
$minutes = ($seconds / 60) % 60;
$hours = round($seconds / (60 * 60));
echo "Time passed: <b>$hours</b> hours and <b>$minutes</b> minutes";
0 comments:
Post a Comment