Ver Mensaje Individual
  #63 (permalink)  
Antiguo 25/04/2005, 12:10
Avatar de Saruman
Saruman
 
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 20 años, 11 meses
Puntos: 5
Calcular la Edad de algo

Hola... esta función calcula la edad de una persona o algo....
Utilizacion:
fecha_nacimiento = "09/10/1981"
edad = Age(fecha_nacimiento)

response.write(edad & " años.")

Resultado: 23 años.


Código:
Function Age(strBirthDate)
	If IsNull(strBirthDate) then Age = 0: Exit Function
	
	varAge = DateDiff("yyyy", strBirthDate, Now)
	If Date < DateSerial(Year(Now), Month(strBirthDate), Day(strBirthDate)) Then
		varAge = varAge - 1
	End If
	Age = CInt(varAge)
End Function
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.