Finding out the weekday

Erik Max Francis max at alcyone.com
Wed Mar 26 03:29:23 EST 2003


John Machin wrote:

> What is this "Doomsday" thingy? The above description certainly shows
> that it is a function of the year only, i.e. doesn't depend on the day
> and the month -- which would appear not to be what the OP was looking
> for e.g day_of_week(today()) returns "Wednesday" (in my
> timezone/locale combination) and will return "Thursday" tomorrow.

He's referring to the Conway algorithm for calculating the day of the
week:

	http://www.interlog.com/~r937/doomsday.html

The "Doomsday" is part of the calculation; it's just an easy way of
finding an "epoch," if you will, for pinpointing the right day of the
week for some day, somewhere in the year so you can work backwards from
that and find the day of the week for your desired day (which can be
arbitrary).  Certainly, as we all know, the day of the week depends on
the year (otherwise it would be trivial to calculate).  I didn't look at
the original poster's comment, presumably he just misrepresented the
Conway algorithm.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ Honesty has nothing to hide
\__/ Joi
    CAGE / http://www.alcyone.com/pyos/cage/
 A cellular automaton simulation system in Python.




More information about the Python-list mailing list