كود: تحديد الكل
function time_diff_mins($start_time, $end_time) {
$start_time = explode(':',$start_time);
$end_time = explode(':',$end_time);
$end_ts = $end_time[0] * 60 + $end_time[1];
$start_ts = $start_time[0] * 60 + $start_time[1];
if ($start_time[0] > $end_time[0]) {
$diff_ts = (24*60) - $start_ts + $end_ts;
} else {
$diff_ts = $end_ts - $start_ts;
}
return $diff_ts;
}
كود: تحديد الكل
$diff_time = time_diff_mins("9:00","17:00");
echo "$diff_time minutes"
480
___________
المصدر :
http://www.php.net/manual/en/function.time.php#89147