|
|
Appendix 2: All About Leap Years
|
| |
|
|
| | | |
| |
|
| |
|
|
|
Why We Have Leap Years
|
| |
A leap year is a year with one extra day inserted -- February 29th -- so that
it has 366 days instead of the usual 365. This is to keep the calendar in synchronization
with the actual orbit of the earth around the sun, so that the seasons continue
to arrive on the same date. Currently, the earth circles the sun in 365.242189
days. This number declines by about .000013 days per century, so in 1500 the length
of the astronomical year would have been 365.242254 days. The leap year system
of the current Gregorian calendar was set up by Pope Gregory XIII and was placed
into effect on October 15, 1582. (In some parts of the world, it was adopted much
later. In Britain and its then colonies in America for instance, it was not adopted
until 1752, and in Turkey not until 1927.) The Gregorian calendar's average year
length of 365.2425 days is much closer to reality than the previous Julian calendar,
which had an average year length of 365.25 days. If we wished to have complete
synchronization, we would need to skip a leap year sometime several thousand years
in the future; we will not worry about this.
Back to Contents
|
|
| |
|
|
|
Rules for Calculating Leap Years in the Gregorian Calendar
|
| |
- Every year divisible by 4 is a leap year. (For example, 1996 was a leap
year.)
- Except that years divisible by 100 years are not leap years. (For example,
1900 was not a leap year.)
- Except that years divisible by 400 years are leap years. (So 2000 will
be a leap year after all.)
The Leap Year Problem is that some programmers got only some of these rules right.
The most spectacular error is that many current spreadsheet programs follow
only rules 1 and 2, but not 3, so they treat the year 2000 as a "common
year", instead of a leap year. (The existence of "corrective macros" has actually
prevented the underlying bug from being fixed.) Many other programs use only
rule 1, so that they incorrectly consider the year 1900 to be a leap year, even
though they get the year 2000 right, by accident. There is
no excuse for not following all three rules and getting this right.
Back to Contents
|
|
| |
|
|
|
How to Test Your Programs for the Leap Year Problem:
|
| |
The easiest way is to get the program to give you the day of the week, and the
day within the year (sometimes called Julian date) for a particular date. The
following table lists the correct values for some of the most sensitive dates:
| Date |
Day-of-Week |
Day-of-Year |
| 1900-02-28 |
Wednesday |
59 |
| 1900-02-29 |
(should be an error) |
| 1900-03-01 |
Thursday |
60 |
| 1900-12-31 |
Monday |
365 |
| 2000-01-01 |
Saturday |
1 |
| 2000-02-29 |
Tuesday |
60 |
| 2000-03-01 |
Wednesday |
61 |
| 2000-12-31 |
Sunday |
366 |
| 2001-01-01 |
Monday |
1 |
|
|
| |
|
|
|
References:
|
| |
- Calendrical
Calculations, by Nachum Dershowitz and Edward M. Reingold, of the
University of Illinois at Urbana-Champaign. Fascinating and comprehensive
coverage of the subject of calendars, by the foremost current experts. This
web page contains a lot of information, allows you to download their programs,
and provides a link for ordering the book. This web page also contains one
of the best lists of calendar links.
Back to Contents
This page last updated 1998-08-20. Please send comments, such as reports of broken
links, to the author: Roger Deschner |
|
| |
|