...

View Full Version : how to convert seconds into minutes and seconds?



Bobafart
06-01-2007, 10:58 PM
if I have a var called $totalSeconds, how do I divide it up into $minutes and $seconds.

my solution doesn't seem to work:

$minutes = round($totalSeconds/60);
$seconds = round($totalSeconds%60);

how to do this?

mr e
06-01-2007, 11:19 PM
$totalSeconds = 400;

$minutes = floor($totalSeconds / 60); // 6 minutes
$seconds = $totalSeconds - ($minutes * 60); // 40 seconds



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum