MYSQL query to calculate Date of Birth


/ Published in: MySQL
Save to your folder(s)



Copy this code and paste it in your HTML
  1. SELECT DATE_FORMAT( FROM_DAYS( TO_DAYS( NOW( ) ) - TO_DAYS( dob ) ) , '%Y' ) +0 AS age
  2. FROM table_name
  3. WHERE `usersid` =14
  4. LIMIT 0 , 30

URL: http://ma.tt/2003/12/calculate-age-in-mysql/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.