Source for file modifier.display_duration.php
Documentation is available at modifier.display_duration.php
* basic function to convert a number of seconds into a human readable format
* @param array $pDuration Duration of event in seconds
* @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
'month' => 60 * 60 * 24 * 7 * 4,
'week' => 60 * 60 * 24 * 7,
foreach( $units as $unit => $secs ) {
if( $pDuration > $secs ) {
$duration[$unit] = floor( $pDuration / $secs );
$pDuration = $pDuration % $secs;
$ret = !empty( $duration['month'] ) ? $duration['month']. tra( 'month(s)' ). ' ' : '';
$ret .= !empty( $duration['week'] ) ? $duration['week'] . tra( 'week(s)' ). ' ' : '';
$ret .= !empty( $duration['day'] ) ? $duration['day'] . tra( 'day(s)' ). ' ' : '';
$ret .= str_pad( $duration['hour'], 2, 0, STR_PAD_LEFT ). ':'. str_pad( $duration['min'], 2, 0, STR_PAD_LEFT ). ':'. str_pad( $duration['sec'], 2, 0, STR_PAD_LEFT );
|