...

View Full Version : Resolved divide miles, speed time formating



sonny
10-12-2012, 01:35 AM
Hi, I am trying to display in minutes, instead of 0.2 hr etc
like the example below will do, now I know every .1 = 6 min
I am just stumped on how to get this to display 12 minutes.



$sum = round(11 / 55,1);// example 11 miles
echo $sum;


I am trying to display things in minutes only when under 1 hour
anyone know how to multiply just that number after the decimal by 6?

Thanks
Sonny

Len Whistler
10-12-2012, 01:57 AM
$sum = round(11 / 55,1);// example 11 miles

$hours = floor($sum);
$minutes = ($sum - $hours)*60;


echo "$hours hours and $minutes minutes";

Output

0 hours and 12 minutes

sonny
10-12-2012, 05:11 AM
Thank You so much
Sonny



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum