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

Calculate age by birthdate? 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

I want to be help by calculate a persons age from the persons bithdate.
I have a lots of VB codes, but no VBScript codes. Do not know the changes between the two code formats so...help

Thanks in advance!
Johanna Pihlström
 
Here you go

sdate = "17/08/1963"
result = DateDiff("d",sdate,Date)
trueage = result / 365
msgbox Left(trueage,2)

Will return the age ie 38 If you do not do the Left it will show 38.967345

If you use FormatNumber instead of Left it will round up to 39.

Regards
Steve Friday
 
Try this:

year1 = inputbox("enter your birthdate?" & vbcrlf & "ex.. 1/1/70")

Daysleft = Date() - cdate(year1)
bday = fix(daysleft / 365)

msgbox bday

cornboy88
[noevil]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top