Skip to content
Advertisement

Calculate age in MySQL (InnoDB)

If I have a person’s date of birth stored in a table in the form dd-mm-yyyy, and I subtract it from the current date, what format is the date returned in?

How can I use this returned format to calculate someone’s age?

Advertisement

Answer

If the value is stored as a DATETIME data type:

Less precise when you consider leap years:

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement