Time & Calendar
Basic

Leap Year Rule

Tests whether a Gregorian year has 366 days.

Formula

leap    (ymod4=0    ymod1000)    (ymod400=0)\text{leap} \iff (y \bmod 4 = 0 \;\wedge\; y \bmod 100 \neq 0) \;\vee\; (y \bmod 400 = 0)

Variables

yYear

Example

2000 is a leap year (÷400); 1900 is not (÷100 but not ÷400)

Did You Know?

The extra 400-year rule keeps the calendar aligned with the solar year to within one day for about 3,300 years.