Current Article:

How to get difference in years between two dates in MySQL?

How to get difference in years between two dates in MySQL?

This query will do the trick:

SELECT TIMESTAMPDIFF(YEAR, created_at, CURDATE()) AS difference FROM my_table

Note: For differences in months, replace YEAR with MONTH, and for days replace YEAR with DAY