Mega Code Archive

 
Categories / VB.Net / Date Time
 

Returns an indication whether the specified year is a leap year

Module IsLeapYear    Public Sub Main()       For year As Integer = 1994 to 2014          If DateTime.IsLeapYear(year) Then             Console.WriteLine("{0} is a leap year.", year)             Dim leapDay As New Date(year, 2, 29)             Dim nextYear As Date = leapDay.AddYears(1)             Console.WriteLine("   One year from {0} is {1}.", _                               leapDay.ToString("d"), _                               nextYear.ToString("d"))          End If       Next    End Sub End Module