diff options
Diffstat (limited to 'app/Helper')
-rw-r--r-- | app/Helper/Dt.php (renamed from app/Helper/Datetime.php) | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/app/Helper/Datetime.php b/app/Helper/Dt.php index 74ea9bdd..be595605 100644 --- a/app/Helper/Datetime.php +++ b/app/Helper/Dt.php @@ -2,15 +2,31 @@ namespace Helper; +use DateTime; + /** * DateTime helpers * * @package helper * @author Frederic Guillot */ -class Datetime extends \Core\Base +class Dt extends \Core\Base { /** + * Get duration in seconds into human format + * + * @access public + * @param integer $seconds + * @return string + */ + public function duration($seconds) + { + $dtF = new DateTime("@0"); + $dtT = new DateTime("@$seconds"); + return $dtF->diff($dtT)->format('%a days, %h hours, %i minutes and %s seconds'); + } + + /** * Get the age of an item in quasi human readable format. * It's in this format: <1h , NNh, NNd * |