{I+=codeWee;}
[ASP] ASP: Calculate Age by Birthday
response.Write GetAge(cdate("1950-1-1"))


function GetAge(birthday)
	age = cint(datediff("yyyy", birthday, date()))
	y = year(date())
	m = month(birthday)
	d = day(birthday)
	thisyearBirthday = cdate(""&y&"-"&m&"-"&d&"")
	if cint(datediff("d", thisyearBirthday, date())) < 0 then
		age = age-1
	end if
	GetAge = age
end function
HTML | PHP | C++ | DirectX11 | Javascript | C# | HTML5 | ASP | SQL | General | CSS | Oculus Rift | Unity3d | Virtools SDK | Tip | NSIS | PowerShell | node.js | Web API | RTSP | All
Copyright© 2016 CodeWee.com All rights reserved.