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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calculate Age in years, months, or days 1

Status
Not open for further replies.

Buckaroo8

Programmer
Aug 6, 2003
27
US
Hi All,
I have three numeric fields to work with:
BirthDay
BirthMonth
BirthYear

How can I utilixe them to calcuate a persons age in Years, or if younger, months or days?

i.e. the result will appear either:
21 y
7 m
18 d

Thanks for all help!
 
Use the Date and the DateDiff functions.

Date(Birthyear,Birthmonth,Birthday) will treat these fields as a date, then use the datediff function to calc the age.

MrBill

 
A datediff of years against a date will give you the wrong age as date diff will only compare the years.

Here's an example for a real age:


Use a formula akin to MrBill's in the formula, as in:

cdate({table.byear},{table.bmonth},{table.bday})

-k
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top