In the Julian calendar, named after Julius Caesar, every fourth year had 366 days rather than 365.
The Gregorian calendar is the calendar used by most of the world. Also called the Christian calendar or Western calendar, it is internationally accepted as a civil calendar by all but a handful of countries. The Gregorian calendar was introduced in 1582 primarily to fix errors in the Julian calendar mostly having to do with leap years.
In the Julian calendar, named after Julius Caesar, every fourth year had 366 days rather than 365. Roman astronomers calculated that a year — the time it takes the Earth to revolve around the sun — had a duration of 365.25 days. This method of adding a leap day every fourth year averaged out to this determined value.
Except, a year’s length isn’t 365.25 days; it’s actually a bit shorter. This only became noticeable as the centuries passed and the calendar drifted out of sync with the seasons. By 16th century AD, people noticed that the first day of spring had drifted 10 days ahead of the intended 20th of March. Basically, history had used a leap-day year 10 more times than was useful.
Recognizing the 10-day error, Pope Gregory XIII had a scholar (Aloysius Lilius) devise a new system that would keep the calendar in sync with the seasons. This new system changed which years should be considered leap years based on what numbers divide the years evenly.
Aloysius devised a system in which every fourth year was a leap year; however, century years that were divisible 400 were exempted.
So, for example, the years 2000 and 1600 were leap years, but not 1900, 1800 or 1700.
While in a 2000-year period, the Julian calendar had 500 leap years, the Gregorian calendar only has 485. This change was based on a calculation that an average year length is 365.2425 days, which was pretty close.
The modern measured value is 365.2422 days, according to NASA. This small difference, coupled with the precession of the equinoxes, amounts to the Gregorian calendar shifting a day out of sync after 7,700 years.