There exist plenty of algorithms that allow you to know the day of the week of a given date. Even though this program is not the most computationally efficient, it is the most friendly to the human brain and super easy to understand. You can run the code on your computer or use it to learn to calculate the day of the week mentally.
The algorithm can only be performed with dates belonging to the Gregorian calendar. In particular, this program only works for dates between 1st January 1600 and 31st December 2399.