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

Age as of January 1...expression

Status
Not open for further replies.

conneticat

Programmer
Jul 16, 2004
47
US
Thought this might be a useful expression to someone somewhere. DOB is, of course, date of birth. I dare you to remove some of the parenthesis...

AgeAsOfJan1: IIf(IsNull([DOB]),"No Age Listed",(Fix(((((Date()+1)-Format(Date(),"y"))-[DOB]))/365.25)) & " yr, " & (((Fix((((((Date()+1)-Format(Date(),"y"))-[DOB]))/365.25)*12)))-((Fix(((((Date()+1)-Format(Date(),"y"))-[DOB]))/365.25))*12)) & " mo")

The outcome: 7 yr, 2 mo
 
conneticat
Thanks for the post.

If a fella saved up enough of those parentheses, he'd soon have enough to hold a garage sale!

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top