Add task analytics

This commit is contained in:
Frederic Guillot
2015-07-05 16:07:21 -04:00
parent 67b9a56469
commit bb8b4c0e36
18 changed files with 186 additions and 27 deletions

View File

@@ -2,14 +2,30 @@
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