Find the Day of a Date using this Calendar Formula

Pope Gregory —  day of a week for a given date after the year 1600 in the Gregorian Calendar.
Pope Gregory

Calendars have very decent stories and since this blog is based on mathematical approach, let we talk about the mathematical aspects of calendars.

The Calendar We Use

The international calendar we use is called Gregorian Calendar, said to be created by Pope Gregory XIII. Gregorian calendar was introduced in 80s of 16th century, to be accurate in 1582 ,---as a correction to earlier Julian Calendar.

Julian Calendar was introduced by Julius Caesar and was based on the fact that there were $ 365 \frac{1}{4}$ days in a year, with leap year every fourth year.

The Concept of Leap Year

Astronomical calculations told us that one year on earth (the time required for the earth to complete an orbit around the sun) was equal to $ 365.2422$ days — thus we can say that Julian Calendar hadn't enough precise measure of dates.

A difference of $ 365 \frac{1}{4}-365.2422 =0.0078$ days per year meant that the Julian Calendar receded a day from its astronomical data every $ \frac{1}{0.0078}$ years (viz. Approx. $ 128.2$ years).

The centuries old calendar came to an end as the accumulating inaccuracy caused the vernal equinox (the first day of Spring) to fall on March 11 instead of its proper day, March 21.

The inaccuracy naturally persisted throughout the year, but at this season it meant that the Easter festival was celebrated at the wrong astronomical time. Pope Gregory XIII rectified the discrepancy in a new calendar, imposed on the predominantly Catholic Countries of Europe.

He decreed that 10 years (11 March to 21 March) were to be omitted from the year $ 1582$ , by having October 15 of that year immediately follow October 4.

At the same time, C. Clavius proposed the scheme for leap years — which must be divisible by 4, except for those marking centuries. Century years would be leap years only if they were divisible by 400. This implies that the century years $ 1600, 2000, 2400$ are leap years, but $ 1700, 1800, 1900, 2100, 2200, 2300$ are not.

How to calculate the day of a week for a given date?

There are many tricks to determine the day of a week for a given date after the year 1600 in the Gregorian Calendar. But we shall use a number-theoretic method to determine it, as described in the book 'ELEMENTARY NUMBER THEORY' by David M. Burton.

We all know that the extra day of a leap year is added to February month of the year, so let us adopt the convenient fiction that each year ends at the end of February.

The months for any year Y are:

1. March
2. April
3. May
4. June
5. July
6. August
7. September
8. October
9. November
10. December
11. January
12. February.

It is clear that if we count for any year $ Y$ , January and February will be $ Y+1$ in next year of Gregorian Calendar.

We need another convenient notation as we denote days by numbers 0,1,2,3,4,5,6 as:

0. Sunday
1. Monday
2. Tuesday
3. Wednesday
4. Thursday
5. Friday
6. Saturday.

The number of days in a common year is $ 365$ , and the number weeks thus are $ \frac{365}{7}$ =52 weeks and 1 day while that in a leap year is $ 366$ claiming the number of weeks being 52 with two extra days. We could write last sentence as this way too:

Number of days in a common year is $ 365 \equiv 1 \pmod {7}$ and that in a leap year is $ 366 \equiv 2 \pmod {7}$ . [See FootNotes]

One extra day remaining after 52 weeks in a common year implies that the day proceeds for 'one' week-day for every year. February 28 is last (365th) day of a common year --- it always falls on the same weekday as the previous year's March 1 . But if it follows a leap year day, the last day February 29, its weekday is increased by two.

We can have a mathematical theorem to find which weekday a fixed date will fall.

THEOREM: The day with month $ m$ , day $ d$ , year $ Y=100c+y$ , where $ c$ (century) is equal to or greater than 16 and $ y$ is any number between 0 and 99 inclusive, has a weekday number

$$ w=d+[2.6 \times m -0.2] -2c+y \\ +[c/4]+[y/4] \pmod{7}$$

Here $ m$ is the number chosen for corresponding month from the [LIST A], $ d$ is the number which represent the date in common sense and the square bracket function $ [x]$ represent the greatest integer less than or equal to $ x$
After finding the numerical value of $ w$ , we match it with [LIST B].

Let me illustrate this with an example.

What day of week will be on December 9, 2011?

For December 9, 2011:
$ m=10$ (see list A)
$ d=9$
$ Y=2011=2000+ 11=100 \times 20 + 11$
$ c=20$
$ y=11$

We have

$ w = d+[2.6 \times m -0.2] -2c+y+[c/4]+ \\ [y/4] \pmod{7}$ as

$$ w \equiv 9+ [2.6 \times 10 -0.2] -2\times 20 +11+ \\ [20/4]+[11/4] \pmod{7} $$

$$ w \equiv 9+[25.8] -40+11+[5]+[2.75] \pmod{7} $$

$$ w \equiv 9+25-40+11+5+2 \pmod{7} \\ \equiv 10+ 2 \pmod{7}$$

$$ w \equiv 5+\pmod{7}$$

This implies that the value of w to be $ 5, 12, 19, 26, \ldots$ but for $ w$ being less than 7, we have $ w=5$ . Comparing with table we get that December 9, 2011 occur on Friday (5).

1. Don't get confused with [2.75] =2 or []=n. For any positive number, the Square Bracket Function (say it Floor Function or Greatest Integer Function) allows you to leave fractional part of the number. Read more at .

2. Let n be a fixed positive integer. Two integers a and b are said to be congruent modulo n, symbolized by $ a \equiv b \pmod{n}$ , if n divides the difference a-b. For simple understanding $ a \equiv b \pmod{n}$ is same to $ a-b=kn$ for any $ k$ being an integer. We can simplify it for $ a$ as $ a=kn+b$ . In particular conditions, $ a=n+b$ ; $ a=2n+b$ , $ a=3n+b, \ldots$ . More details at

Well, it's your turn now:

Find on which weekdays these dates fall:
1. July 4, 1776
2. October 19, 1992
3. August 15, 1947
4. March 21, 1688
5. June 8, 2333.

Here are the solutions:

1. July 4, 1776
Y=1776=100*17 +76
$ w \equiv 4+[2.6 \times 5-0.2]-2\times 17+76+ \\ [17/4]+[76/4] \pmod{7}$
$ w \equiv 4+12-34+76+4+19 \pmod{7}$
$ w \equiv 62+19 \pmod{7}$
$ w-62 \equiv 19 \pmod{7}$
or, w-62 divided by 7 gives 19 as remainder.
Or, w-62-19=w-81 is divided by 7.
Choosing w from 0 to 6, we have w=4, since 4-81=-77 is completely divisible by 7.
Thus the weekday on July 4, 1776 was Thursday.

2. October 19, 1992
You'll get,
$ w \equiv 97+23 \pmod{7}$
$ w-97 \equiv 23 \pmod{7}$
or, w-97-23=w-120 is divisible by 7.
w=1, since
1-120=-119 is divisible by 7.
Hence the Weekday on October 19,1992 was Monday.

3. w=5 Friday
4. w=0 Sunday
5. w=4 Thursday