1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| $heure1 = "".$data['heure'].":".$data['minutes'].":00";
$heure2 = "".$data['heure_arr'].":".$data['minutes_arr'].":00";
list($h1, $m1, $sec1) = explode(':', $heure1);
list($h2, $m2, $sec2) = explode(':', $heure2);
$timestamp1 = mktime ($h1, $m1, $sec1, 7, 9, 2006);
$timestamp2 = mktime ($h2, $m2, $sec2, 7, 9, 2006);
$diff_heure = floor(abs($timestamp2 - $timestamp1)/60);
echo $diff_heure."min";
$timestamp = abs($timestamp2 - $timestamp1);
$diff_heure = floor($timestamp / 3600);
$timestamp = $timestamp - ($diff_heure * 3600);
$diff_min = $timestamp / 60;
echo $diff_heure . 'h' . $diff_min . 'min'; |
Partager