Day of the Week

Ever wonder what day you were born on? Well, you can find out with this neat little script. Simply type your date of birth in the box below, and it will tell you ... honest!

Zeller's Algorithm can be used to determine the day of the week for any date in the past, present or future, for any dates between 1582 and 4902.

To use this algorithm, input your date of birth, and then boom the day of the week in which you were born on appears.

The Nursery Rhyme

Monday's child is fair of face,
Tuesday's child is full of grace,
Wednesday's child is full of woe,
Thursday's child has far to go.
Friday's child is loving and giving,
Saturday's child works hard for a living,
But the child born on the Sabbath Day,
Is fair and wise and good in every way.

That is an old Nursery Rhyme about the days of the week that is supposed to tell your character or future based on the day you were born.

If it were true, do you think people would notice that most models were born on Monday (fair of face)? Or most dancers were born on Tuesday (full of grace)?

Do your own research to find if there is any truth in it!

Only since 1582

This only works in the Gregorian Calendar that replaced the old Julian Calendar in 1582 (or other years in other countries, such as 1751 in Great Britain).


Zeller's Algorithm in JavaScript

Zeller's Algorithm takes year, month and day numbers and uses some basic math (+ − × ÷) and the floor function (which removes any digits after the decimal point).

This is what it looks like in JavaScript (parseInt is used instead of floor):

if (nMonth >= 3) {
nMonth -= 2;
} else {
nMonth += 10;

if ((nMonth == 11) || (nMonth == 12)) nYear--;

var nCentury = parseInt(nYear / 100);
var nYear100 = nYear % 100;

var h = 0;    // day of week number
h += parseInt(nDay);
h += parseInt((13 / 5) * nMonth - 0.2);
h += parseInt(nYear100);
h += parseInt(nYear100 / 4);
h += parseInt(nCentury / 4);
h -= parseInt(2 * nCentury);
h %= 7;

if (nYear >= 1700 && nYear <= 1751) {
h -= 3;
} else {
if (nYear <= 1699) h -= 4;

if (h < 0) h += 7;