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!

Age Calculation

Status
Not open for further replies.

nksampat

Programmer
Dec 6, 2003
2
US
Hi,
I have the date of birth of a person in eight byte numeric format. I want to calculate the afe of the person as of the report date.
Say if the person was born od January 1 1980, then his age as of now would be 23.93567
Any clue on how to do it on crystal 9?

Thanks!
 
You would need to convert your 8 byte numeric format to a date. Since you didn't post that, I can't give you any direction there.

As far as calculating Age accurately, ChelseaTech posted this formula a while back and I have been using it to calculate age since.

@AGE
Code:
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

~Brian
 
Sorry, forgot to add that you would convert your field to a date and then use that variable in place of {table.birthdate}

~Brian
 
This gives me only the number of years.
I want the remaining days of the year to be divided by 365.
I require the exact age as of today (something like 26.245665) and not just 26.00
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top