There are many solutions; basically it seems that in order to do
this well one has to exploit the fact that our calendar has some
sort of structure. In short, all months look the same if you
just rename the days of the week. #2, for example, takes this
into account: in a non-leap year January and October "look the
same", as do February, March and November; September and
December; April and July. Incidentally, this is not a problem I
particularly worry about, because I know the Doomsday algorithm.
In short: - It is relatively easy to determine what day of the
week the last day of February falls on in a given year. (Because
of leap years, a lot of calendar algorithms focus on this day.
There are some cases where for the purposes of formulas it is
convenient to think of January and February as the 13th and 14th
months of the previous year.) This day of the week is called
"Doomsday". Doomsdays run in a 400-year cycle, as does the
entire Gregorian calendar. Doomsday in 1900 was a Wednesday, and
in 2000 it was a Tu