Minutes To Hours

<?php function printTime($minutes) { if($minutes > 60){ $hours = floor($minutes/60); $minutes = (int)$minutes - $hours*60; if($minutes > 0){ echo "{$hours}h {$minutes}min "; } else{ echo "{$hours}h"; } } else{ echo $minutes . 'min'; } } /* printTime($minutes) $minutes - czas w minutach zostanie zamieniony na czas w postaci 1h 45min */ ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.