## 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.

### Table 2

Month | Common | Leap |

May, December, September | 9 | 2 |

July, April | 3 | 3 |

November, March | 0 | 0 |

October | 4 | 4 |

February | 0 | -1 |

June | 1 | 1 |

August | -1 | -1 |

January | -3 | 3 |

### 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

### Table 1

Centuries | Result |

0 | 1 |

1 | 6 |

2 | 4 |

3 | 2 |