Here is a .NET centric way to do it w/out knowing anything about leap years:
Imports System.Globalization
' ...
Private Function IsLeapYear(ByVal yr As Integer) As Boolean
Return CultureInfo.CurrentCulture.Calendar.IsLeapYear(yr)
End Function
This function is culture (language) aware.
: : This function should do it ...
: :
: :
: : Private Function IsLeap(ByVal year As Integer) As Boolean
: : Return ((year Mod 4 = 0) AndAlso (year Mod 100 <> 0) OrElse (year Mod 400 = 0))
: : End Function
: :
: :
: Hi,
: here's another trick
:
Public Function IsLeapYear(Yr As Integer) As Boolean
: Return Date.TryParse(Yr & "-2-29")
: End Function
: but iwilld0it's solution is better! (Parsing date from string is time-consuming)
: Faster than parsing (but with same idea) and slower than IsLeap is
:
Private Function IsLeapYear(ByVal Yr As Integer) As Boolean
: Return (New Date(Yr, 2, 28)).AddDays(1).Month = 2
: End Function
:
:
Pavlin II[/size]
:
:
Don't take life too seriously anyway you won't escape alive from it!
:
:
: