...PAUL.LOCKETT...

DAY OF THE WEEK FINDER

Day: Month: Year:

 
This piece of javascript returns the day of the week for any given date. There are two warnings I would attach to it:

1. I haven't put any date validation into the program, so if you enter an invalid date such as 31st June, 29th February in a year which isn't a leap year or even the 51st day of the 17th month, it will still return an answer.

2. The calculations are based on the current calendar, so if you put in a date which goes back centuries to when the calendar was different, the answer is likely to be wrong.

I may revise the script to incorporate validation and historical calendars at some point, but then again, if I can't be bothered, I might not!

The script also tells you what kind of person you are according to the Monday's Child rhyme, based on what day of the week you were born.

Hat tip to Aboutify, where I found the method for calculating the day.


You can re-use the code in this page under the terms of the Mozilla Public Licence v2.0. See the licence notice in the source of the page for more details.