Difficulty:
For a given date in the 1900s century (
19XX
years), calculate which day of week it was. Information you may need:
January 1, 1900
was a Monday.- Months of a year have 31, "28 or 29"*, 31, 30, 31, 30, 31, 31, 30, 31, 30, and 31 days in order.
- The second month (February) has 28 days in normal years, and 29 days in leap years.
- A year is a leap year if its number is divisible by 4, unless it is divisible by 100 too. Years divisible by 400 are exceptionally leap years.
Please do not use built-in date functions, and avoid pre-computing anything in your solution.
(disclaimer: any historically-significant date in the test data is accidental)
dayOfWeek(1900, 3, 2);
"FRIDAY"