My date of birth format is : 2017-Feb-15
when I am using the following query, it's not working
select (year(current_date)-year(dob)) as age from user
or how to current 2017-Feb-15 into 2017-02-15 format
My date of birth format is : 2017-Feb-15
when I am using the following query, it's not working
select (year(current_date)-year(dob)) as age from user
or how to current 2017-Feb-15 into 2017-02-15 format
You can use TIMESTAMPDIFF.
select TIMESTAMPDIFF(YEAR, str_to_date(dob, '%Y-%M-%d'), current_date) AS age
from user;