Ver Mensaje Individual
Antiguo 25-abr-2005, 12:10   #63 (permalink)
Saruman
Saruman está en el buen camino
 
Avatar de Saruman
 
Fecha de Ingreso: mayo-2003
Ubicación: Panamá
Mensajes: 1.154
Enviar un mensaje por MSN a Saruman Enviar un mensaje por Yahoo  a Saruman
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.
Saruman está desconectado   Responder Citando