The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Date::Doomsday - Determine doomsday for a given year

SYNOPSIS

  use Date::Doomsday;
  $doomsday = doomsday(1945);

VERSION

$Revision: 1.12 $

DESCRIPTION

Doomsday is a concept invented by John Horton Conway to make it easier to figure out what day of the week particular events occur in a given year.

doomsday

    $doomsday = doomsday( 1945 );

Returns the day of the week (in the range 0..6) of doomsday in the particular year given. If no year is specified, the current year is assumed.

AUTHOR

Rich Bowen (rbowen@rcbowen.com)

Doomsday

Doomsday is a simple way to find out what day of the week any event occurs, in any year. It was invented by Dr John Horton Conway.

In conjunction with Date::DayOfWeek, it can calculate the day of the week for any date since the beginning of the Gregorian calendar.

The concept of doomsday is simple: If you know this special day (called "doomsday") for a given year, you can figure out the day of the week for any other day that year by a few simple calculations that you can do in your head, thus:

The last day of February is doomsday. That's the 28th most years, and the 29th in leap years.

The Nth day of the Nth month is doomsday, for even values of N. That is, 4/4 (April 4), 6/6, 8/8, 10/10, and 12/12, are all doomsdays. (That is, if doomsday is Wednesday, as it is in 2001, then October 10 will also be a Wednesday.)

For odd months, after March, the following mnemonic will help you remember: "I work from 9-5 at the 7-11." (For those of you not living in the USA, you might like to know that 7-11 is the name of a chain of stores.) What this means is that 9/5 (September 5) and 5/9 (May 9) are both doomsday. Likewise, 7/11 and 11/7 are doomsday.

The 0th day of march is always doomsday.

The last day of January is doomsday in most years, and the day after tha last day of January (think January 32nd) is doomsday in leap years.

So, if you know the above, and you want to figure out what day of the week a particular day is, you do something like the following:

When is Christmas in 2001? Doomsday in 2001 is Wednesday. So December 12 is Wednesday. Count forward 2 week, and find that December 26 is a Wednesday. So Christmas (December 25) is a Tuesday.

For more information about the origins and mathematics surrounding doomsday, see the following web sites:

http://rudy.ca/doomsday.html

http://quasar.as.utexas.edu/BillInfo/doomsday.html

http://www.cst.cmich.edu/users/graha1sw/Pub/Doomsday/Doomsday.html