Return to Snippet

Revision: 47675
at June 13, 2011 18:58 by nebojsac


Initial Code
$seconds = 60;
echo "seconds = $seconds<br />";
	$start_seconds = round($seconds);
	if($start_seconds <60)
	{
		$minutes ="";
		$seconds = $start_seconds;
	}
	else
	{
		
		$minutes = floor($start_seconds/60);
		$seconds = $start_seconds - $minutes*60;
		
		$minutes = "$minutes"."m";
		$seconds = $seconds."s";
	}
	echo "$minutes $seconds";

Initial URL
tricksbycinger.blogspot.com

Initial Description
Takes the seconds, and returns minutes. Will wrap it in a function is anyone is interested. Example:  92s -> 1m 32s

Initial Title
Convert Seconds to Minutes PHP

Initial Tags
php

Initial Language
PHP