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

breaking age into year and month

Status
Not open for further replies.

barny2006

MIS
Mar 30, 2006
521
US
hi,
is there a way to use modula or something like that to break age into years and month accurately in a single expression?
thanks.
 
Barny2006 -

Can you provide a unit for age? Is it months, days, minutes?

Thanks

strebor
 
how about this

Code:
birthday = "5/30/1962"

TotalMonthsOld = DateDiff("M",birthday,Now())
YearsOld = TotalMonthsOld/12
MonthsOld = TotalMonthsOld - (Int(YearsOld)*12)
TotalDaysOld = DateDiff("D",birthday,Now())
WScript.Echo "You are " & Int(YearsOld) & " Years, " & MonthsOld & " Months Old."

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top