Zeller worked out a formula to calculate the day of the week for any date.
$$d= \left(n+\mbox{int}\left[\frac{(m+1)\times 26}{10}\right]+y+\mbox{int}\left[\frac{y}{4}\right]+\mbox{int}\left[\frac{C}{4}\right]-2C\right)\mbox{mod }7$$
This formula contains a lots of symbols and terminology, as follows:

In Zeller's formula $d$ stands for the day of the week, numbered $0$ to $6$ for Saturday - Friday.

$n$ is the day of the month, numbered 1 to 28, 29, 30 or 31 depending on the month in question.

$m$ is the month, numbered from $3-12$ for March - December; $m=13$ in January and $m=14$ in February.

$y$ is the last two digits of the year, or the last two digits of the previous year if $m=13$ or $14$.

$C$ is the first two digits of the year.

'int[$x$]' is a function which rounds $x$ down to the nearest integer or returns $x$ if $x$ is already an integer.

'mod 7' means return the remainder when divided by 7.