karmicrepublic
asked on
Calculate A Persons Age
How do i compute a persons age? if there's a leap year?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
test for leap year
Public Function IsLeapYear(Yr As Integer) As Boolean
'Set default return value
IsLeapYear = False
'If year is divisible with four then it's a leap year, unless
'is divisible by 100 but not by 400...
If Yr Mod 4 = 0 Then
IsLeapYear = True
If Yr Mod 100 = 0 Then
If (Yr Mod 400) Then IsLeapYear = False
End If
End If
End Function
Public Function IsLeapYear(Yr As Integer) As Boolean
'Set default return value
IsLeapYear = False
'If year is divisible with four then it's a leap year, unless
'is divisible by 100 but not by 400...
If Yr Mod 4 = 0 Then
IsLeapYear = True
If Yr Mod 100 = 0 Then
If (Yr Mod 400) Then IsLeapYear = False
End If
End If
End Function
Why the 'B' grade? I supplied two working links and one with source code.
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=2900