Return difference in time using php -


this question has answer here:

with following line date in y-m-d format.

echo date('y-m-d',strtotime($result["created_at"])); 

its creation date of account. id calculate how old account can print out 5 years, 5 months example.

any ideas?

try this: create current date , use difference.

$currentdate = new date(); $interval = $currentdate->diff(new date($result["created_at"])); echo $interval->y . ' years , ' . $interval->m . ' months'; 

Comments