Calculate which day of the week a date falls in using modular arithmetic

Before the Doomsday method (see link in Theo Buehler's comment), there was a formula due to Gauss. A good write-up is Berndt Schwerdtfeger, Gauss' calendar formula for the day of the week, available at http://berndt-schwerdtfeger.de/cal/cal.pdf


The Zeller congruence is yet another method for reckoning the day of the week of a given date. Kim Larsen presents an implementation of a variant of the Zeller congruence in this article. (There is additional discussion of Larsen's formulation here.)