Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Working Out Age from Date of Birth 2

Status
Not open for further replies.

janedane

Programmer
Mar 8, 2004
22
IE
CR 9.2

Hi All,

I need to work out the Age from the Date of Birth. AT the moment I am doing a
DateDiff("YYYY",DateofBirth,CurrentDate)
But That is not completely correct. If the are born in Dec 00 and it's Jan 04 it says that they are four years old. Has anyone done this before??

Any help would be greatly appreciated!!!

Jane
 
Hi !

I have a formula that I use.

I think I have found it here on Tek-Tips, but have no idea from who.

if month({table.birthdate}) < month(CurrentDate) or
//Had their birthday earlier in the year
(month({table.birthdate}) = month(CurrentDate) and
(day({table.birthdate}) <= day(CurrentDate)))
//Had their birthday earlier this month
Then
year(CurrentDate) - year({table.birthdate})
else
year(CurrentDate) - year({table.birthdate}) -1

/Goran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top