Return to Snippet

Revision: 54722
at January 9, 2012 20:51 by zierocode


Initial Code
function formatTime($secs) {
	$time = '';
	foreach (array(3600, 60, 1) as $i => $sec) {
		$time .= sprintf('%02d', floor($secs / $sec)).($i < 2 ? ':' : '');
		$secs = $secs % $sec;
	}
   return $time;
}

Initial URL


Initial Description
This code is applied from http://www.ultramegatech.com/blog/2009/06/snippet-converting-seconds-to-readable-time/

Initial Title
Converting second to readable time

Initial Tags
convert

Initial Language
PHP