Return to Snippet

Revision: 25719
at April 7, 2010 03:27 by jodm


Updated Code
function roundTime($blnRoundDown = true) {
	$seconds = time();
	
	$rounded_seconds = ($blnRoundDown) ? floor($seconds / (5 * 60)) * (5 * 60) : round($seconds / (5 * 60)) * (5 * 60);

	return date('H:i', $rounded_seconds);	
}

Revision: 25718
at April 7, 2010 02:46 by jodm


Initial Code
$seconds = time();
$rounded_seconds = round($seconds / (5 * 60)) * (5 * 60);

Initial URL

                                

Initial Description

                                

Initial Title
Round Time to Nearest

Initial Tags

                                

Initial Language
PHP