VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo

by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Fri 2nd April 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Determine if a year is a leap year by checking if it is a valid date on the system. This assumes your system is Y2K compliant.

Rate Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo



'     yr is either a date or an integer
'     rely on Windows DateSerial function
Public Function IsLeapYear(yr As Variant) As Boolean
   If VarType(yr) = vbDate Then
      IsLeapYear = (Day(DateSerial(Year(yr), 2, 29)) = 29)
   Else
      IsLeapYear = (Day(DateSerial(yr, 2, 29)) = 29)
   End If
End Function

Download this snippet    Add to My Saved Code

Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo Comments

No comments have been posted about Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo. Why not be the first to post a comment about Determine if a year is a leap year by checking if it is a valid date on the system. This assumes yo.

Post your comment

Subject:
Message:
0/1000 characters