Page 1 of 1

Getting the age of someone

Posted: Tue Jan 09, 2007 5:08 pm
by emmbec
Hi I know this may seem like a very basic question but I just don't seem to figure it out. I have a record in my Database which is the date of birth, and I want to know how old that person is. How could I do it?? My column in my DB is of type DATE. Thanks

Posted: Tue Jan 09, 2007 5:54 pm
by aaronhall

Code: Select all

SELECT DATEDIFF(birthdayColumn, CURDATE());
Will return the number of days since the date. Though, floor($daysPastBirthday / 365) won't account for leap years.