How the Gregorian Calendar Works
The Gregorian calendar is the solar calendar used for civil dates almost everywhere: 12 months, 365 days in a common year and 366 in a leap year. Pope Gregory XIII introduced it in 1582 to fix a slow drift in the older Julian calendar, and its one clever idea is a leap year rule that skips three leap days every 400 years. That rule, plus a few Roman leftovers, explains nearly everything odd about the dates on your wall.
The calendar most of the world uses
A solar calendar tries to keep its dates in step with the seasons, so that the March equinox always falls around March 20 and midsummer in the northern hemisphere always lands in late June. The Gregorian calendar does this very well. The US Naval Observatory calls it "the internationally accepted civil calendar", and it is the one behind passports, contracts, computer clocks and the ISO 8601 date format.
Plenty of other calendars are still in daily use alongside it. The Islamic calendar is purely lunar, so its months move through the seasons. The Hebrew and Chinese calendars are lunisolar and add a leap month every few years. They set religious festivals and traditional holidays, while civil and business life in China, India and most other countries runs on Gregorian dates.
From Julian to Gregorian
The Julian calendar, introduced by Julius Caesar in 45 BC, had a simple rule: every fourth year is a leap year. That gives an average year of 365.25 days. The solar (tropical) year is about 365.2422 days, so the Julian year was too long by roughly 11 minutes. Eleven minutes a year adds up to one full day every 128 years or so.
By the 1500s the error had reached about 10 days. The church fixed Easter by assuming the spring equinox fell on March 21, but the real equinox was arriving around March 11. The USNO notes that the reform was driven by exactly this: the need to repair the calculation of Easter.
Gregory XIII's papal bull Inter gravissimas made two changes. It dropped 10 days at once, so that Thursday, October 4, 1582 was followed by Friday, October 15, 1582 in the first countries to adopt it. And it changed the leap year rule so the drift would not come back. The weekday sequence was never broken; only the day numbers jumped.
The leap year rule
A year is a leap year if it is divisible by 4, except that years divisible by 100 are not, unless they are also divisible by 400. So 1900 was a common year, 2000 was a leap year, and 2100 will be a common year.
The arithmetic is neat. The Julian rule gives 100 leap days per 400 years. The Gregorian rule removes three of them (in 1700, 1800 and 1900, or 2100, 2200 and 2300), leaving 97. That makes the average year 365 + 97/400 = 365.2425 days, only about 26 seconds longer than the tropical year. The calendar will drift by one day in roughly 3,200 years, which is a problem nobody alive needs to solve.
The full test, the next leap years and what happens to February 29 birthdays are in our guide to leap year rules.
Why months have 28 to 31 days
The month lengths are an inheritance from the Roman calendar as Julius Caesar left it, not a design anyone would choose today. They follow no clean pattern, which is why rhymes and tricks exist to remember them.
| Month | Days | Month | Days |
|---|---|---|---|
| January | 31 | July | 31 |
| February | 28 (29 in a leap year) | August | 31 |
| March | 31 | September | 30 |
| April | 30 | October | 31 |
| May | 31 | November | 30 |
| June | 30 | December | 31 |
The knuckle trick works on any hand. Make a fist and count across the knuckles and the dips between them, starting with January on the first knuckle. Knuckles are 31-day months, dips are the short ones. After July on the last knuckle, start again on the first knuckle with August, which is why July and August are both 31 days long.
Month lengths are also why "one month from January 31" has no clean answer. Software usually rolls it to February 28 (or 29), and contracts often define it explicitly. If you need an exact span, count days rather than months with the date calculator.
The 400-year cycle and weekdays
Four hundred Gregorian years contain 303 common years and 97 leap years, which is 146,097 days. That number divides by 7 exactly: 20,871 weeks. So the whole calendar, weekdays included, repeats every 400 years. January 1, 2000 was a Saturday, and January 1, 2400 will be a Saturday too.
Inside that cycle, individual years repeat more often. A year's calendar is fixed by two things: the weekday of January 1 and whether it is a leap year. That leaves only 14 possible calendars. The 2026 calendar, for example, was also used in 2009 and 2015 and comes back in 2037 and 2043, so an old 2015 wall calendar would have worked all year.
One side effect of the 400-year cycle: the 13th of the month is not evenly spread across the weekdays. Counting all 4,800 months in a cycle, the 13th falls on a Friday 688 times, more than on any other day.
Find the weekday of any date: the Doomsday method
The mathematician John Conway popularized a mental method built on one observation: in any given year, a set of easy dates always share the same weekday. He called that weekday the year's "doomsday". The easy dates are 4/4, 6/6, 8/8, 10/10 and 12/12, plus 5/9, 9/5, 7/11 and 11/7 ("9 to 5 at the 7-11"), plus March 14 and the last day of February. In January it is the 3rd in common years and the 4th in leap years.
- Take the century anchor: Wednesday for the 1900s, Tuesday for the 2000s, Sunday for the 2100s.
- Take the last two digits of the year (call it y) and add y divided by 4, dropping the remainder.
- Divide that sum by 7 and keep the remainder. Count that many days forward from the anchor. The result is the year's doomsday.
- Find the nearest doomsday date in your month and count forward or back to your date.
Worked example for July 20, 1969, the day of the first Moon landing. The 1900s anchor is Wednesday. y = 69, and 69 ÷ 4 = 17 with the remainder dropped, so the sum is 86. 86 ÷ 7 leaves 2, and two days after Wednesday is Friday, the doomsday for 1969. July 11 (from "7-11") was therefore a Friday, July 18 a Friday too, and July 20 a Sunday. That matches the record.
Second example, this year: 2026 gives 26 + 6 = 32, which leaves 4 after dividing by 7. Four days after Tuesday is Saturday, so every doomsday date in 2026 is a Saturday. July 4, 2026 was a Saturday, which makes July 17, 2026 a Friday. With practice the whole thing takes about ten seconds; for anything you need on paper, the date calculator shows the weekday of any date directly.
Who switched when
The reform was a Catholic one, and Protestant and Orthodox states took their time. That is why "the date" of a historical event can differ by 10 to 13 days depending on which calendar the writer was using. Historians mark the two systems as Old Style and New Style.
| Where | Last Julian date | First Gregorian date |
|---|---|---|
| Italian states, Spain, Portugal, Catholic Poland | October 4, 1582 | October 15, 1582 |
| France | December 9, 1582 | December 20, 1582 |
| Protestant German states, Denmark, Norway | February 18, 1700 | March 1, 1700 |
| Great Britain and its colonies | September 2, 1752 | September 14, 1752 |
| Sweden (including Finland) | February 17, 1753 | March 1, 1753 |
| Soviet Russia | January 31, 1918 | February 14, 1918 |
Britain had to skip 11 days rather than 10 because 1700 had been a leap year in the Julian calendar but not in the Gregorian one. The Calendar (New Style) Act 1750 did two things: it moved the start of the legal year from March 25 to January 1, and it declared that the day after September 2, 1752 would be called September 14. The American colonies changed with it, which is why George Washington's birthday is recorded both as February 11, 1731 and as February 22, 1732. The full story is in why September 1752 lost 11 days.
Sweden tried to ease in gradually from 1700 by skipping leap days, got it wrong, went back to the Julian calendar in 1712 by giving that February 30 days, and finally switched in one step in 1753. Russia's change came after the revolution, so the "October Revolution" of 1917 took place in November by the Gregorian count. Several Orthodox churches still use the Julian calendar to set religious dates, which is why their Christmas falls on January 7.
Tools
The date calculator counts days between any two dates and adds or subtracts days, weeks or months, with the leap year rule built in. Week numbers follow their own ISO rule, explained in what week number it is and applied to next year in ISO week numbers for 2027. For a date you are waiting for, set a countdown and let it do the counting.
Frequently asked questions
When did the Gregorian calendar start?
On Friday, October 15, 1582, in Italy, Spain, Portugal and Catholic Poland. Britain and its colonies adopted it in September 1752, and Russia in February 1918.
What is the difference between the Julian and Gregorian calendars?
Only the leap year rule. The Julian calendar adds a leap day every four years without exception; the Gregorian skips it in century years not divisible by 400, and the two are now 13 days apart.
Why does February have 28 days?
It is a leftover of the Roman calendar, which the Julian reform kept as the short month. The leap day is still added to February.
How often does the calendar repeat?
The full Gregorian calendar repeats every 400 years. A single year's calendar comes back after 6, 11 or 28 years, depending on where it falls relative to leap years.
Every date, offset and calculation on this page was checked against the sources below.