|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
script for how old in someone on a certain date
Anyone got a script for showing how old someone will be on a future date?
I want to be able to ask the script : I was born on the 16th June 1981. How old will I be on 27th January 2007? Thanks. Brian
__________________
Try to look unimportant. The enemy may be low on ammo. |
|
#2
|
||||
|
||||
|
Code:
birthDate = "06/16/1981"
fDate = "01/27/2007"
Response.write(calculateAge(birthDate, fDate))
function calculateAge(Date1, Date2)
bornDate = CDate(Date1)
futureDate = CDate(Date2)
if(Month(futureDate) < Month(bornDate) OR Month(futureDate) = Month(bornDate) AND Day(futureDate) < Day(bornDate)) Then
age = Year(futureDate) - Year(bornDate) - 1
else
age = Year(futureDate) - Year(bornDate)
end if
calculateAge = age
end function
|
|
#3
|
||||
|
||||
|
Thanks memnock
|
![]() |
| Viewing: ASP Free Forums > Other > Programming Help > script for how old in someone on a certain date |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|