IsLeapYear
Returns whether or not a DateTime is during a leap year.
Source
public static bool IsLeapYear(this DateTime value)
{
return (System.DateTime.DaysInMonth(value.Year, 2) == 29);
}
Example
if (DateTime.Today.IsLeapYear())
{
Response.Write("It is a leap year!");
}