How to calculate age from date of birth column in mysql?
In this post we will give you information about How to calculate age from date of birth column in mysql?. Hear we will give you detail about How to calculate age from date of birth column in mysql?And how to use it also give you demo for it if it is necessary.
Sometimes, we require to get age from birthdate using mysql select query, we can do it in programming like php,.net and etc framework but if we can do it using mysql query. In bellow example mysql query you can learn how to get age from date field. We can get age value from using mysql DATEDIFF(). So, let’s see bellow query.
Example:
SELECT
id,
(DATEDIFF(CURRENT_DATE, STR_TO_DATE(born_date, '%Y-%m-%d'))/365) as age
FROM 'users'
Hope this code and post will helped you for implement How to calculate age from date of birth column in mysql?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs