User login

PHP function to format seconds as hours:minutes:seconds

Could not find a built-in PHP function to convert seconds to minutes and such, so here's a utility function candidate. Seems it should be easier...

<?php
/**
* Present a number of seconds as hours, minutes, and seconds.
*
* Utility function candidate for inclusion in an Agaric utility module.
*/
function visitorpath_au_hms($seconds, $pad_hrs = FALSE) {
$o = '';
$hrs = intval(intval($seconds) / 3600);
$o .= ($pad_hrs) ? str_pad($hrs, 2, '0', STR_PAD_LEFT) : $hrs;
$o .= ':';
$mns = intval(($seconds / 60) % 60);
$o .= str_pad($mns, 2, '0', STR_PAD_LEFT);
$o .= ':';
$secs = intval($seconds % 60);
$o .= str_pad($secs, 2, '0', STR_PAD_LEFT);
return $o;
}