Solved

CALCULATE AGE OF PERSON FROM DOB INPUT

Posted on 2004-04-07
1,151 Views
Hi experts,

I need a quick classic ASP formula to calculate a persons age as of todays date (whatever that may be) based on a DOB input captured in the following format:

3 drop down boxes as follows:

dobDay (1-31), dobMonth (1-12), dobYear(1900-2004)

Thanks,

PJORDANNA

0
Question by:pjordanna

LVL 11

Accepted Solution

Slimshaneey earned 500 total points
function getAge(dtDOB)
dim iAge, dtTmp, dtToday
dtToday = Date()
iAge = CInt(DateDiff("yyyy",FormatDateTime(dtDOB,1),Date()))
dtTmp = CDate((Day(dtDOB) & "/" & Month(dtDOB) & "/" & Year(Date
())))
if (dtTmp > Date) then iAge = iAge - 1
getAge = iAge
end function

dim DOB
DOB = "15/01/1974"

Response.Write " 1. DoB is " & DOB
Response.Write " <BR>2. Age is " & getAge(DOB)
0

Author Comment

Slimshaneey,

Perfect!

PJORDANNA
0

Featured Post

Suggested Solutions

trim spaces before first character 6 70
Classic ASP - x-editable save to SQL 3 62
EOF BOF error classic asp 8 28
Update field in order 21 108
I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.