Solved

CALCULATE AGE OF PERSON FROM DOB INPUT

Posted on 2004-04-07
2
1,165 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
ID: 10773607
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
ID: 10773866
Slimshaneey,


Perfect!



PJORDANNA
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Both in life and business – not all partnerships are created equal. Spend 30 short minutes with us to learn:   • Key questions to ask when considering a partnership to accelerate your business into the cloud • Pitfalls and mistakes other partners…

911 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

21 Experts available now in Live!

Get 1:1 Help Now