The true length of a year is 365.242 days. Because this is not an integral number, any calendar which has years of a fixed length cannot maintain synchronism with true solar time over any lengthy period. The calendar now used by many nations of the world, the Gregorian calendar, assigns 365 days to most years. It is then necessary to add an extra day every fourth year to keep time straight. However, this would only maintain synchronism if the year were 365.25 days long. Because it is a little less than this, it is necessary to drop the leap year approximately once each century.

There are three rules which determine whether a year is leap (ie has an extra day). These are:

  1. - If a year is divisible by 4 it is leap unless,
  2. - If a year is divisible by 100 it is not leap unless,
  3. - If a year is divisible by 400 it is leap.
Many people are not aware of the third rule, although it is this rule that made the year 2000 a leap year. To make leap year determination an automated process, a simple QBASIC (Quick Basic) program is presented below.

   'Leap Year Determination Program (LEAP.BAS)
   INPUT "Year (eg 1998)";yr
   IF yr MOD 4 = 0 THEN leap$ = "Y"
   IF yr MOD 100 = 0 THEN leap$ ="N"
   IF yr MOD 400 = 0 THEN leap$ = "Y"
   IF leap$ = "Y" THEN
     PRINT yr; " is a leap year"
     PRINT yr; " is NOT a leap year"
Even this Gregorian calendar is not perfect and becomes 1 day out every 3323 years. A fourth rule (if a year is divisible by 4000 it is not leap) would correct this to one day in 20,000 years.