### Question 20.32

Will 2000 be a leap year? Is `(year % 4 == 0)` an accurate test for leap years?

Yes and no, respectively. The full expression for the present Gregorian calendar is

    	year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)

See a good astronomical almanac or other reference for details. (To forestall an eternal debate: references which claim the existence of a 4000-year rule are wrong.)

Read sequentially: prev next up top

This page by Steve Summit // Copyright 1995 // mail feedback