Solved

CALCULATE AGE OF PERSON FROM DOB INPUT

Posted on 2004-04-07
2
1,200 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

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 informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

631 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