Re: Year 2000 leap year?
Posted in 1997
I'm sorry, but the correct algorithm (albeit computationally inefficient) can be written (using % as the modulo operator and integer arithmetic): if (year % 400 == 0) it is a leap year; else if (year % 100 == 0) it is not a leap year; else if (year % 4 == 0) it is a leap year; else it is not a leap year; Using this algorithm, we find that 2000 is a leap year, 1900 wasn't, 1996 was, 1997 isn't. And 2000 is not given exceptional treatment under this regime. If you delve back into history, life gets more interesting. Most of continental Europe changed to the modern (Gregorian) system in 1584, so 1600 was a leap year in Europe. But Britain (and her colonies) didn't change until 1752, so in those countries, 1600 was not a leap year. And when the British switched to the Gregorian system, the correction was one day more than the correction when Europe switched. Oh what fun! BTW: Informix software does not understand the subtleties of the calendar prior to 1753. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h> }From: Daniel Wright <danwright@bigfoot.com> }Date: Wed, 15 Jan 1997 22:52:11 -0600 }X-Informix-List-Id: <news.32635> } }Catalin Badea (cat@tecsys.com) wrote: }> "Stuart Knight" <Stuart_Knight@lendlease.com.au> wrote: }> > The year 2000 IS a leap year. }> > }> > The definition of a leap year is one that can be divided EXACTLY by 4, }> > and in the case of a new Century (1900, 2000, etc.) to also be EXACTLY }> > divisible by 400. }> }> Small clarification, that shouldn't be "new Century" but "last year in a }> Century". }> }> 1900 is not the beginning of a new century, it is the end of one (the 19th }> century). } }years divisible by 4 are leap years, EXCEPT for the years which are }divisible by 400, which are NOT leap years. Therefore, 2000 should NOT }be a leap year. }However, I was told (by a very unreliable source who sounded as though }he heard it from a reliable source) that 2000 was an exception, }allegedly to correct a problem with the Julian calendar. I have not }seen this "news" anywhere else, so if you know, please also respond by }e-mail as I am remiss in checking the newsgroup on a regular basis.