I am getting the correct hours and minutes by removing the seconds.
E.g. date("h:i",strtotime($end_time)).
I am still open to a more efficient way to accomplish this task.
[php]
<?
$end_time = "2008-09-05 20:59:13";
$start_time = "2008-09-05 19:00:16";
$end = date("h:i",strtotime($end_time));
$start = date("h:i",strtotime($start_time));
$diff = strtotime($end) - strtotime($start);
//convert to min and sec
$convert_min = $diff/60;
$convert_sec = $diff % 60;//seconds
//convert to hours and min
$convert_hr = floor($convert_min/60);//hours
$remainder = floor($convert_min % 60);//minutes
$total_visit = $convert_hr.":".$remainder;
?>
[/php]
Reputation Points: 24
Solved Threads: 0
Junior Poster in Training
Offline 89 posts
since Oct 2006