Day of the Week Calculator

This is an example of calculating the day of the week from a numerical date.


Implementing Zeller's Congruence using JavaScript

Zeller's Congruence classic equation

Zeller used decimal arithmetic

Zellers Congruence Equation

Zeller's Congruence converted for easier computational implementation

"J" and "K" are calculated using the standard year which introduces some additional modifications such as treating January and February as months 13 and 14 of the previous year. "-2J" is converted to "+5J" to avoid negative numbers and is simply advancing the days by 7 which still results in the same day of the week and avoids taking the modulus of a negative number which bothers JavaScript but which Zeller appears not to have minded.

Zellers Congruence modified equation for easier algorithmic implementation

Bibliography

Wikipedia Article on Zeller's Congruence