On the Subject of Weekdays
What day is it today? Hang on, I know today’s date. Give me a minute.
- Enter the correct day of the week corresponding to the shown date. The used date format is: YYYY-MM-DD.
- Enter the weekday before the timer runs out.
Calculating the weekday
- Split the year into centuries and remaining years. (1994 becomes 19 & 94)
Add the following numbers:
- Centuries modulo 4, mapped using Table 1.
- If the remaining years are an odd number, add 11 to it. Divide the resulting number by 2. Again, if the number is odd, add 11. Find the difference between the nearest multiple of 7 above this number and the number itself.
- The day of the month.
- The month mapped to a number from Table 2.
- Keep subtracting 7, until the resulting number lies in 0-6. Mondays are 0, Tuesdays are 1, and so on.
|May, December, September||9||2|
Determining leap years
Take the following steps in order to determine whether a given year is a common or a leap year:
- Year not divisible by 4: common year
- Year not divisible by 100: leap year
- Year not divisible by 400: common year
- Otherwise leap year