OK, so you can get the day of the week for any date in 2021. That's neat. But what about for other years?
So. Piscatology 101. Remember the 12-digit calendar for 2021? Well, the following table is a list of month offsets you will use to find dates in any whatever year you're looking for. You'll do this in three steps: 1) Find the base number for the year, 2) Find the number for your target month, 3) Find the day of the week for the target date.
Let's start with the most likely practical application: years in the recent past or future.
- First, get the base number for the year.
- Start with the last two digits of the year you want.
- Divide that by 4, and add the integer result to your year*. (If your year is a leap year, AND you're finding a date in January or February, subtract 1.)
- Next, find your taget month.
- Get the month's offset value from the above table, and add it to the base number for the year. This is the target month's number. Note: You can divide this by 7 and use the remainder, if that's more convenient for you.
- Finally, get the day of the week.
- Add the date to the target month's number.
- Divide by 7, and keep the remainder.
- The remainder is the number of the day of the week. (If there is no remainder, the date falls on a Saturday.)
Let's try an example or two.
How about September 16, 2025.
- Start with the last two digits of the year: 25.
- Divide by 4, and add the integer result to your year. The integer part of 25 divided by 4 is 6. Add 6 to 25, for a total of 31 (3, if you reduce).
- The offset for September is 5, so add 5 to 31, giving you 36 (1, if you reduce).
- The date is the 16th, so add 16 to 36 (or 1), giving you 52 (or 17).
- Divide 52 (or 17) by 7, and keep the remainder. The remainder is 3.
- September 16, 2025 falls on the 3rd day of the week, which is Tuesday.
Now, let's try a leap year. How about February 4, 2028:
- Start with the last two digits of the year: 28.
- Divide by 4, and add the integer result to your year. The integer part of 28 divided by 4 is 7. Add 7 to 28, for a total of 35. Since 2028 is a leap year, AND you're looking for a date in January or February, subtract 1, leaving 34 (6, if you reduce).
- The offset for February is 3, so add 3 to 34 (or 6), giving you 37 (or 9, which you could further reduce to 2).
- The date is the 4th, so add 4 to 37 (or 2), giving you 41 (or 6).
- Divide 41 (or 6) by 7, and keep the remainder. The remainder is 6.
- February 4, 2028 falls on the 6th day of the week, which is Friday.
0 3 3 6 1 4 6 2 5 0 3 5