$mpsAgeT = $today->diff($mpsAgeT);
Where $today
is:
object(DateTime)[37]
public 'date' => string '2019-06-17 13:40:56.888563' (length=26)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Sofia' (length=12)
and $mpsAgeT
is:
object(DateTime)[38]
public 'date' => string '2016-06-15 13:40:56.000000' (length=26)
public 'timezone_type' => int 3
public 'timezone' => string 'Europe/Sofia' (length=12)
Returns me 3 years, but 15.06 is an older date, so I want to return 4 years, 3 are passed and 4 year is started.
If I just added 1 year, it will not work if date is not passed or equal.
For example:
17.06.2019 and 17.06.2016 - should returns me 3
17.06.2019 and 19.06.2016 - should returns me 3
17.06.2019 and 15.06.2016 - should returns me 4