I'm trying to use CakePHP's TimeHelper.
Let's say I have this date: Tue, 07 Jun 2011 10:53:31 GMT
Its' epoch time is: 1307444011
I need to get difference output with now, like this: 2 years, 24 days, 15 hours, 27 minutes and 43 seconds
I tried this:
$userCreatedTimeStr = $this->Time->timeAgoInWords(
1307444011, array(
'end' => '+10 year',
'accuracy' => array('second' => 'second')
)
);
But this code gives 2 years ago
.
How can I fix this?
Edit: some test code is like this: http://apigen.juzna.cz/doc/cakephp/cakephp/source-class-CakeTimeTest.html#189-229
It seems like using core PHP functions is mandatory, rather than TimeHelper.
How to calculate the difference between two dates using PHP?