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

determine age from birthday format

Status
Not open for further replies.

sap1958

Technical User
Oct 22, 2009
138
US
{BirthDay.corebrthmn}+'/'+{BirthDay.corebrthdy}+'/'+{BirthDay.corebrthyr}

THis format produces a birthday with a number data type
ie 12/21/1985. I know want to determine the age based on this date format. Remember it is in a number format
As an example a person born on 12/1/1985 just turned 24 whereas a person born on 12/21/1985 turns 24 on that day. How can I accomplish this and produce a formula for @Age
 
If your formula works without error, it is a string, as are the component parts. Use Ken Hamady's formula as follows:

WhileReadingRecords;
DateVar Birth:= date(val({BirthDay.corebrthyr}),val({BirthDay.corebrthmn}), val({BirthDay.corebrthdy}));
DateVar Ann := {ages.DateAnn}; // Replace this with CurrentDate to get their age as of the time of the
//report or the date field of an event to get their age as of the time of that event.
if (Month(Ann) * 100) + Day (Ann) >=(Month(Birth) *100) + Day (Birth)
then Year (Ann) - Year(Birth)
else Year (Ann) - Year(Birth) -1

-LB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top