Skip to content
Tutorials Center
My learning

Topics

Lesson 40 of 86 ยท Algebra, Geometry and Calendars

Calendars

Find the day of the week for any date with odd days, handle leap year rules, and spot repeating calendars, then test the method with a checker.

A week has seven days, so the days of the week repeat in a cycle of 7. That makes calendar questions a branch of remainders: you count how many days pass between two dates and keep only the remainder when you divide by 7. This remainder is called the number of odd days. If today is Wednesday and 100 days pass, only 100 mod 7 = 2 matters, so the day is Friday.

In this lesson you will learn the leap year rule, the odd days of years, centuries and months, a step-by-step method for the day of the week of any date, and how to tell when two years share the same calendar. If remainders feel rusty, review Remainders and Cyclicity first.

Odd days and the leap year rule

An odd day is a day left over after removing complete weeks. Number the days from Sunday = 0 to Saturday = 6.

  • An ordinary year has 365 days = 52 weeks + 1 day, so 1 odd day.
  • A leap year has 366 days = 52 weeks + 2 days, so 2 odd days.

A year is a leap year if it is divisible by 4, except that century years (ending in 00) must be divisible by 400. So 2024 and 2000 are leap years, while 1900 and 2100 are not, and 2022 is not.

Counting years 1 to 100, the century year 100 is not a leap year, so there are 24 leap years and 76 ordinary years. That gives the standard odd-day values for whole centuries:

Period Odd days
100 years 5
200 years 3
300 years 1
400 years 0

For 100 years: 24 leap years (2 odd days each) and 76 ordinary years (1 each) give 48 + 76 = 124 odd days, and 124 mod 7 = 5. Doubling gives 10 mod 7 = 3, tripling gives 15 mod 7 = 1, and four centuries give 20 mod 7 = 6, plus the extra leap day of the 400th year, which makes it 21 mod 7 = 0. Every 400 years the calendar repeats exactly.

Odd days of the months

Month Days Odd days
January 31 3
February 28 (29 in leap years) 0 (1)
March 31 3
April 30 2
May 31 3
June 30 2
July 31 3
August 31 3
September 30 2
October 31 3
November 30 2
December 31 3

Months with 31 days leave 3 odd days, months with 30 days leave 2, and February leaves 0 (or 1).

Finding the day of the week of a date

To find the day for a date such as day D of month M in year Y:

  1. Complete centuries: take the odd days of the full centuries before the year (for the year 1947, the 1900 years before it count as 1600 + 300 = 0 + 1 = 1 odd day).
  2. Remaining complete years: for the years from the start of the current century up to the year before Y, add the number of years plus the number of leap years among them, then take the remainder mod 7.
  3. Complete months of year Y before month M (use 29 for February in a leap year).
  4. The date itself D.
  5. Add all four, divide by 7, and read off the day: 0 = Sunday, 1 = Monday, 2 = Tuesday, 3 = Wednesday, 4 = Thursday, 5 = Friday, 6 = Saturday.
flowchart LR
    A["Odd days of<br/>complete centuries"] --> E["Add"]
    B["Odd days of<br/>years since the century"] --> E
    C["Odd days of<br/>months before the date"] --> E
    D["The date D"] --> E
    E --> F["Remainder mod 7 = day"]

Four pieces add up to one remainder, and the remainder is the weekday.

Worked example: 15 August 1947

  • Century 1900: 1900 years = 1600 (0 odd days) + 300 (1 odd day) = 1.
  • Years 1901 to 1946: 46 years, with leap years 1904, 1908, ..., 1944, which is 11. Odd days = 46 + 11 = 57, and 57 mod 7 = 1.
  • Months January to July 1947 (ordinary year): 3 + 0 + 3 + 2 + 3 + 2 + 3 = 16, and 16 mod 7 = 2.
  • Date: 15 mod 7 = 1.

Total = 1 + 1 + 2 + 1 = 5 = Friday.

Worked example: 26 January 1950

  • Century 1900: 1.
  • Years 1901 to 1949: 49 years with 12 leap years, so 61 mod 7 = 5.
  • No complete months.
  • Date: 26 mod 7 = 5.

Total = 1 + 5 + 5 = 11, and 11 mod 7 = 4, which is Thursday.

If you know one anchor date, count forward or backward from it: the same weekday returns after exactly 7 days. 1 January 2001 was a Monday, which makes a handy anchor for the 2000s.

Repeating calendars

Two years have the same calendar when they start on the same weekday and are both leap years or both ordinary years. The question is then how far to count forward.

  • Start from the next year after Y and add up the odd days of each year until the total is a multiple of 7, with the same leap status.
  • For ordinary years, the calendar of 2015 repeats in 2026: the years 2015 to 2025 are 11 years including 3 leap years (2016, 2020, 2024), so 11 + 3 = 14 odd days, which is 0 mod 7.
  • For leap years, the pattern typically returns after 28 years (as long as no century exception lies in between).

Common calendar questions

  • Day after a number of days: compute the days mod 7 and move forward. 100 days after a Wednesday is 2 days later, a Friday.
  • Same day next year: the day moves forward by 1 (or by 2 if the next 29 February falls between the two dates).
  • Count of a weekday in a month: 28 days give each weekday exactly 4 times, and the extra 1, 2 or 3 days of the month repeat the weekdays at the start. In a 31-day month starting on Thursday, Thursday, Friday and Saturday each occur 5 times.
  • Leap years between two years: count multiples of 4, remove century years not divisible by 400. From 1901 to 2000 inclusive there are 25 leap years (1904 to 2000 in steps of 4).
flowchart TB
    A["Is the year divisible by 4?"] -->|No| B["Ordinary year"]
    A -->|Yes| C["Does it end in 00?"]
    C -->|No| D["Leap year"]
    C -->|Yes| E["Divisible by 400?"]
    E -->|Yes| D
    E -->|No| B

Follow the three questions to decide whether a year is a leap year.

A day-of-week checker

The script below implements the odd-day method directly and compares it with JavaScript's own date arithmetic for thousands of dates. It then prints the days for the worked examples and tests the repeating-calendar claim.

JS Odd days vs built-in dates

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The checker takes the odd days of the complete centuries from the table (0, 5, 3, 1 repeating every four centuries), adds the years since the century began, then the months and the date. The test runs across a full 400-year cycle and should report 0 mismatches.

Next, explore which years share a calendar with 2024, a leap year, and how long the wait is.

JS Find repeating calendars

Press Run (or Ctrl + Enter) to see the console output here.

No output.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. How many odd days are there in 100 years?

    A century has 24 leap years and 76 ordinary years: 24 x 2 + 76 = 124 odd days, and 124 mod 7 = 5.
  2. 2. Which of these years is a leap year?

    2000 is divisible by 400, so it is a leap year. 1900 and 2100 are century years not divisible by 400, and 2022 is not divisible by 4.
  3. 3. If today is Wednesday, what day will it be after 100 days?

    100 mod 7 = 2, so the day is 2 days after Wednesday: Friday.
  4. 4. 15 August 1947 was a Friday. What day was 15 August 1948?

    1948 is a leap year and 29 February 1948 lies between the two dates, so the day moves forward by 2: Friday becomes Sunday.
  5. 5. 1 January 2024 was a Monday. What day was 1 January 2025?

    2024 is a leap year with 366 days, which is 2 odd days. Monday + 2 = Wednesday.

Summary

  • Calendar questions are remainder questions: only the leftover days mod 7 matter.
  • An ordinary year has 1 odd day and a leap year has 2; century years need divisibility by 400.
  • 100, 200, 300 and 400 years have 5, 3, 1 and 0 odd days, so the calendar repeats every 400 years.
  • Add odd days of centuries, years, months and the date, then take mod 7 (0 = Sunday).
  • Two years share a calendar if they start on the same weekday and have the same leap status.

Next: Counting Principles and Permutations, where we begin the chapter on counting arrangements.