A leap year is a year containing one additional day, which falls on Feb 29 in the Gregorian calendar.
A leap year (or intercalary or bissextile year) is a year containing one additional day in order to keep the calendar year synchronized with the astronomical or seasonal year.
Because seasons and astronomical events do not repeat in a whole number of days, calendars that have the same number of days in each year, over time, drift with respect to the event that the year is supposed to track. By inserting (or intercalating) an additional day or month into the year, the drift can be corrected. A year that is not a leap year is called a common year.
More about leap years in general are on Wikipedia here.
In computing, we usually are usually referring to the Gregorian Calendar, which inserts an additional day on February 29th into a leap year. A leap year is a year which satisfies both of the following criteria:
- It is evenly divisible by 4.
- It is not evenly divisible by 100 unless it is also evenly divisible by 400.
A common implementation of this algorithm is:
bool isLeapYear = year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
Leap Year Bugs
Leap years can create bugs in software. This is described in the following post: