Find Leap Years
Find Leap Years
By using LeapYearQ with DateDifference, you can find leap years and the intervals between them.
leapyears = Select[DateRange[{1600}, {2012}, "Year"], LeapYearQ[#]&]Table[DateDifference[leapyears[[i]], leapyears[[i + 1]], "Year"], {i, 1, Length[leapyears] - 1}]//UnionWhile leap years most commonly come in four-year intervals, they sometimes come every eight years. This is because a traditional leap day every four years is actually a slight overcompensation in the calendar. Thus, a leap year is skipped every 100 years when those years are not divisible by 400:
Table[DateDifference[leapyears[[i]], leapyears[[i + 1]], "Year"], {i, 1, Length[leapyears] - 1}]//UnionDeleteCases[Table[If[DateDifference[leapyears[[i]], leapyears[[i + 1]], "Year"] === {8, "Year"},
{leapyears[[i]], leapyears[[i + 1]]}], {i, 1, Length[leapyears] - 1}], Null]