ExtensionMethod.NET Home of 819 C#, Visual Basic, F# and Javascript extension methods

IsLeapDay

Checks if the current day is a leap day

Source

public static Boolean IsLeapDay(this DateTime date)
{
    return(date.Month == 2 && date.Day == 29);
}

Example

Boolean isLeapDay = new DateTime(2012, 2, 29).IsLeapDay();

Author: Ricardo Peres

Submitted on: 29 feb 2012

Language: C#

Type: System.DateTime

Views: 3278