How to Find the Day of the Week for a Given Date

Pope Gregory VIII (1502-1585)
Pope Gregory VIII (1502-1585)

A calendar is a fundamental tool that we routinely use to plan and organize our lives. We rarely think about the many different types of calendars that mankind has used over the centuries. In this post I will discuss the difference between the Julian and Gregorian calendars, and present algorithms for finding the day of week for a given Julian or Gregorian calendar date. Hopefully teachers and parents will use this post to create a variety of interesting mathematical activities to give students practice with basic math operations, and develop the ability to maintain concentration by following the steps in a somewhat complicated algorithm. Answer keys can be easily created by accessing an online Day-of-Week calculator.

The Julian calendar was introduced in 46 BC by Julius Caesar, and Pope Gregory VIII introduced the Gregorian calendar in 1582. A steady shift in the date of Easter was the motivation for adopting the Gregorian calendar by the Catholic church. Other names for the Gregorian calendar are the Western calendar and Christian calendar. Countries such as Italy, France and Spain adopted the Gregorian calendar shortly after it was introduced, but England did not adopt the Gregorian calendar until 1752. Russia didn’t convert to the Gregorian calendar until 1918 because the Gregorian calendar had its origin in the Roman Catholic church. The Gregorian calendar is now the most internationally used civil calendar. If you do any type of historical research, it’s important to know whether a date is a Julian or Gregorian calendar date. Dates in time are not necessarily simple facts.

So what is the essential difference between the Julian and Gregorian calendars? Both calendars have leap years, but leap years occur slightly less often in the Gregorian calendar than in the Julian calendar. I will give an intuitive explanation of leap years in a calendar by considering Earth orbits having different periods.

  • In the Julian calendar, the mean length of a year equals 365.25 days = 365 ¼ days. To account for the extra ¼ day each year, an extra day is added to February in all years that are multiples of 4 such as 1628, 1752, 1800 and 1964.
  • Now suppose that the length of a year equals 365.2 days = 365 1/5 days. To account for the extra 1/5 day each year, the calendar would add an extra day in February in all years that are multiples of 5 such as 1775, 1800, 1945.and 2120.
  • Next suppose that the length of a year equals 365.5 days = 365 ½ days. To account for the extra ½ day each year, the calendar would add an extra day in February in all years that are multiples of 2 such as 1778, 1802, 1946 and 2136.
  • In the Gregorian calendar, the mean length of a year equals 365.2425 days. To account for the extra 0.2425 days each year, it was decided to add an extra day in February in the years that are multiples 4 or 400, but not multiples of 100. Hence the years 1600, 2000, 2400 and 2800 are leap years, but 1700, 1800, 1900 and 2100 are not leap years. All other years that are multiples of 4 such as 1776, 1812, 1936 and 2008 are leap years.

Before I can show you the Julian and Gregorian calendar algorithms for finding the day of week for given a date, I need to explain how the floor(x) function and binary mod operator works. The floor(x) function rounds the input value x down to the nearest integer. The p mod q operation gives us the remainder when integer p is divided by integer q ≠ 0. If p or q is negative, different programming languages will produce different mod operator results. In this post, it’s only necessary to deal with integer values of p and q such that p ≥ 0, and q > 0. The text box below illustrates how these functions work.

day_of_week_txtbx1a

The text box below describes Zeller’s Day-of-Week algorithm for Gregorian calendars. Experienced computer programmers or veteran spreadsheet users will find it easy to implement the algorithm in a computer program or spreadsheet. The algorithm should give correct results until about year 4900.

day_of_week_txtbx2a

The two text boxes below show how the Gregorian Day-of-Week algorithm can be applied. I find it interesting and fun to pick significant historical dates. Since England adopted the Gregorian calendar in 1753, the Gregorian calendar must have been adopted in the United States by 1800.

day_of_week_txtbx3a

day_of_week_txtbx4a

The text boxes below show how the Day-of-Week algorithm for Julian calendars. As previously mentioned, it’s important to know if a date is a Julian or Gregorian calendar date. In the two examples for Isaac Newton’s birthday, note that one date is a Julian calendar date and the other is a Gregorian calendar date. I’m sure Newton would have preferred that future historians report his Julian date of birth because it’s nicer for a Christian to say they were born on Christmas day 1642 rather than on January 4, 1643.

day_of_week_txtbx5

day_of_week_txtbx6

day_of_week_txtbx7

Leave a Reply

Your email address will not be published. Required fields are marked *