Does anyone know how i can calculate my age and remaining days with MySQL, taking into account of leap years?
I found examples which can calculate the total number of days.
But i want a result like:
22 years, 134 days,
23 years, 361 days
24 years, 11 days
For now i got this:
SELECT
name,
dob,
TIMESTAMPDIFF( YEAR, dob, now() ) as _year,
TIMESTAMPDIFF( MONTH, dob, now() ) % 12 as _month,
FLOOR( TIMESTAMPDIFF( DAY, dob, now() ) % 30.4375 ) as _day
FROM
client
But this doesn't work and % 30.4375 is not a solution for leap years.