Determining the day of the week for an arbitrary date according to the Gregorian calendar
PHP
Hard
date
Task «Determining the day of the week for an arbitrary date according to the Gregorian calendar»
Write a PHP script that accepts a date in the format 'YYYY-MM-DD' and outputs the day of the week in Russian. The date can be any date (from January 1, 0001 to December 31, 9999). Leap years must be correctly handled according to the Gregorian calendar (divisible by 4, but not by 100, unless divisible by 400). Using built-in PHP functions for working with dates (e.g., date, DateTime) is prohibited.
Input Format
One line containing a date in the format YYYY-MM-DD.
Output Format
One line — day of the week in English: 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' or 'Sunday'.
Examples
Example 1
INPUT
2000-01-01
OUTPUT
Суббота
Example 2
INPUT
1900-01-01
OUTPUT
Понедельник
main.php