How it is worked out
the weekday repeats every 7 days, so it is the remainder of the day count divided by 7
Why it is done this way
Weekdays cycle with a period of seven, so the day of the week for any date is fixed by how many days separate it from a date whose weekday you already know. The complication is only in counting those days correctly across months and leap years.
Step by step
- Count the days elapsed from a reference date you know
- Divide by seven and keep the remainder
- The remainder tells you how far round the cycle you are
- Add that offset to the reference weekday
What is worth knowing
There are mental methods for this — the Doomsday algorithm is the best known — and they all rest on the same fact: the calendar repeats exactly every 400 years, because 400 Gregorian years contain a whole number of weeks. That also means the 13th of the month falls on a Friday slightly more often than on any other day, which is a genuine quirk of the Gregorian calendar rather than superstition. One caution for historical dates: countries adopted the Gregorian calendar at different times, from 1582 in Catholic Europe to 1923 in Greece, so a date before adoption may have been recorded under the Julian calendar and fall on a different weekday.