{code snipped}
You could probably simplify this a bit with mktime(). The syntax is
mktime(hours, minutes, seconds):
$minsec = explode(":", $time);
$numsecs += mktime(0, $minsec[0], $minsec[1]);
That'll give you the number of seconds. Then at the end, you can say:
echo(floor($totalseconds / 60)
> can anybody help me how to count seconds, minutes and hours in php?
> I want to sum values like 03:35, 02:31, 04:59, etc. and show the
> results in minutes.
Here's how I would try to do it:
\n";
?>
There's probably several other ways to do it. YMMV.
Don't miss the Zend Web Store's Grand Op
2 matches
Mail list logo