Swat/SwatString.php
public static function getHumanReadableTimePeriodParts(
        $seconds,
        $interval_parts = null
    ) {
        // Depend on getTimePeriodParts() to return the correct parts requested
        $parts = static::getTimePeriodParts($seconds, $interval_parts);

        // Add human readable formatting to each returned part.
        if (isset($parts['years'])) {
            $years = $parts['years'];
            $parts['years'] = sprintf(
                Swat::ngettext('%s year', '%s years', $years),
                $years
            );
        }

        if (isset($parts['months'])) {
            $months = $parts['months'];
            $parts['months'] = sprintf(
                Swat::ngettext('%s month', '%s months', $months),
                $months
            );
        }

        if (isset($parts['weeks'])) {
            $weeks = $parts['weeks'];
            $parts['weeks'] = sprintf(
                Swat::ngettext('%s week', '%s weeks', $weeks),
                $weeks
            );
        }

        if (isset($parts['days'])) {
            $days = $parts['days'];
            $parts['days'] = sprintf(
                Swat::ngettext('%s day', '%s days', $days),
                $days
            );
        }

        if (isset($parts['hours'])) {
            $hours = $parts['hours'];
            $parts['hours'] = sprintf(
                Swat::ngettext('%s hour', '%s hours', $hours),
                $hours
            );
        }

        if (isset($parts['minutes'])) {
            $minutes = $parts['minutes'];
            $parts['minutes'] = sprintf(
                Swat::ngettext('%s minute', '%s minutes', $minutes),
                $minutes
            );
        }

        if (isset($parts['seconds'])) {
            $seconds = $parts['seconds'];
            $parts['seconds'] = sprintf(
                Swat::ngettext('%s second', '%s seconds', $seconds),
                $seconds
            );
        }

        return $parts;
    }
public static function getHumanReadableTimePeriodParts(
        $seconds,
        $interval_parts = null
    ) {
        // Depend on getTimePeriodParts() to return the correct parts requested
        $parts = static::getTimePeriodParts($seconds, $interval_parts);

        // Add human readable formatting to each returned part.
        if (isset($parts['years'])) {
            $years = $parts['years'];
            $parts['years'] = sprintf(
                Swat::ngettext('%s year', '%s years', $years),
                $years
            );
        }

        if (isset($parts['months'])) {
            $months = $parts['months'];
            $parts['months'] = sprintf(
                Swat::ngettext('%s month', '%s months', $months),
                $months
            );
        }

        if (isset($parts['weeks'])) {
            $weeks = $parts['weeks'];
            $parts['weeks'] = sprintf(
                Swat::ngettext('%s week', '%s weeks', $weeks),
                $weeks
            );
        }

        if (isset($parts['days'])) {
            $days = $parts['days'];
            $parts['days'] = sprintf(
                Swat::ngettext('%s day', '%s days', $days),
                $days
            );
        }

        if (isset($parts['hours'])) {
            $hours = $parts['hours'];
            $parts['hours'] = sprintf(
                Swat::ngettext('%s hour', '%s hours', $hours),
                $hours
            );
        }

        if (isset($parts['minutes'])) {
            $minutes = $parts['minutes'];
            $parts['minutes'] = sprintf(
                Swat::ngettext('%s minute', '%s minutes', $minutes),
                $minutes
            );
        }

        if (isset($parts['seconds'])) {
            $seconds = $parts['seconds'];
            $parts['seconds'] = sprintf(
                Swat::ngettext('%s second', '%s seconds', $seconds),
                $seconds
            );
        }

        return $parts;
    }
public static function getHumanReadableTimePeriodParts ( $ seconds , $ interval_parts = null ) { // Depend on getTimePeriodParts() to return the correct parts requested $ parts = static :: getTimePeriodParts ( $ seconds , $ interval_parts ) ; // Add human readable formatting to each returned part. if ( isset ( $ parts [ 'years' ] ) ) { $ years = $ parts [ 'years' ] ; $ parts [ 'years' ] = sprintf ( Swat :: ngettext ( '%s year' , '%s years' , $ years ) , $ years ) ; } if ( isset ( $ parts [ 'months' ] ) ) { $ months = $ parts [ 'months' ] ; $ parts [ 'months' ] = sprintf ( Swat :: ngettext ( '%s month' , '%s months' , $ months ) , $ months ) ; } if ( isset ( $ parts [ 'weeks' ] ) ) { $ weeks = $ parts [ 'weeks' ] ; $ parts [ 'weeks' ] = sprintf ( Swat :: ngettext ( '%s week' , '%s weeks' , $ weeks ) , $ weeks ) ; } if ( isset ( $ parts [ 'days' ] ) ) { $ days = $ parts [ 'days' ] ; $ parts [ 'days' ] = sprintf ( Swat :: ngettext ( '%s day' , '%s days' , $ days ) , $ days ) ; } if ( isset ( $ parts [ 'hours' ] ) ) { $ hours = $ parts [ 'hours' ] ; $ parts [ 'hours' ] = sprintf ( Swat :: ngettext ( '%s hour' , '%s hours' , $ hours ) , $ hours ) ; } if ( isset ( $ parts [ 'minutes' ] ) ) { $ minutes = $ parts [ 'minutes' ] ; $ parts [ 'minutes' ] = sprintf ( Swat :: ngettext ( '%s minute' , '%s minutes' , $ minutes ) , $ minutes ) ; } if ( isset ( $ parts [ 'seconds' ] ) ) { $ seconds = $ parts [ 'seconds' ] ; $ parts [ 'seconds' ] = sprintf ( Swat :: ngettext ( '%s second' , '%s seconds' , $ seconds ) , $ seconds ) ; } return $ parts ; }
Gets the parts to construct a human-readable string representing a time
period.

This method formats seconds as a time period. Given an example value
of 161740805, the following key=>value array is returned.
<code>
<?php
array(
'years'   => '5 years',
'months'  => '3 months',
'days'    => '2 days',
'seconds' => '5 seconds',
);
?>
</code>

As this method applies on seconds, no time zone considerations are
made. Years are assumed to be 365 days. Months are assumed to be 30 days.

@param integer $seconds seconds to format.
@param integer $interval_parts inclusive or bitwise set of parts to
return.

@return array An array of human-readable time period string parts.
Gets the parts to construct a human - readable string representing a time period .