I checked and this is not a duplicate. I have this function
$since = date('Y-m-d H:i:s', strtotime($since));
$date = new DateTime($since);
$interval = $date->diff(new DateTime('now'));
return $interval->format('%y years, %m months, %d days, %h hours and %i minutos ago %s seconds ago');
But of course, I get a date like “5 years, 2 months, 5 days …. “
What I want to get is just one part of the interval. Meaning, I dont want to get “0 years, 0 months, 0 days”, but lets say “3 minutes” or “5 days” etc…
I’m new with DateTime but didn’t find a function in the php.net site that did that. Is there one or I have to create one by myself? Thanks!
This is what I came up with: