Solved

CALCULATE AGE OF PERSON FROM DOB INPUT

Posted on 2004-04-07
2
1,151 Views
Last Modified: 2008-03-04
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
Comment
Question by:pjordanna
2 Comments
 
LVL 11

Accepted Solution

by:
Slimshaneey earned 500 total points
Comment Utility
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

by:pjordanna
Comment Utility
Slimshaneey,


Perfect!



PJORDANNA
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
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.

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now