Chronology Current Month Current Thread Current Date
[Year List] [Month List (current year)] [Date Index] [Thread Index] [Thread Prev] [Thread Next] [Date Prev] [Date Next]

Re: Calendar




On Mon, 28 Jul 1997 18:36:38 -0600 Jim Green <JMGreen@Sisna.com> writes:

Is there somewhere in the NET where I can look up what day of the week
corresponds to a given date???


Jim Green
JMGreen@sisna.com





Hi Jim, You can do it quickly yourself with the following formula:
(here goes)

First determine the value of delta:

The earlier date can be either A not a leap year, B before leap day, or C
after leap day.
The later date can be X, Y, Z meaning the same as A, B, and C. Then,
delta equals one for A&X, A&Z, and B&X. All the rest are zero, except
C&Y and B&Z, which are undefined. (I am not sure right now, but it will
come to me soon, I hope.) I happen to know that January 1, 1996 (before
leap day) was a Monday = 1(mod 7), just as you know that July 28, 1997 is
a Monday = 1 (mod 7). We wish to know what day of the week was December
25, 1896 (after leap day).


First, we must find L (mod 7), the same day as the target date in the
earlier year. (Aha, that's why C&Y and B&Z are undefined.) This
requires learning a few numbers; one set for leap years and one set for
not. First me: If Jan 1, 1996 = 1(mod 7), then Dec. 25, 1996 was
4(mod 7). How do I know? I have a chart for leap years.

1,_,2,_,3,_,4,_,5,_,6,_,7,_,8,_,9,_,10,_,11,_,12 (month number)
_,3,_,1,_,3,_,2,_,3,_,2,_,3,_,3,_,2,_,,,3,_,,,2,_,,,(3) (calendar advance
mod 7)
_,3,_,4,_,0,_,2,_,5,_,0,_,3,_,6,_,1,_,,,,4,_,,,6,_,,,(2) (cumulative
calendar advance mod 7) Notice that if Jan 1= 1, Feb 1 =4, Mar 1 =
1+4=5(mod 7).

I have a very similar chart for regular years. Only February is
different, but that difference propagates through the cumulative advances
throughout the year. Just subtract one. What? You can't learn 12
numbers?

The Equation

Earlier day, E (mod 7) = Later day, L (mod 7) - [Take greatest integer
in the following item in parentheses (Difference between year numbers,
M, divided by four) + delta] (mod 7) - (Difference in year numbers, M)
(mod 7) .

E (mod 7) = L(mod 7) - [GINT(M/4) + delta](mod 7) - M (mod 7)

Your sample problem: 5* - [GINT(101/4) + 0] (mod 7) - 101 (mod 7)
= 5 - 4 - 3 = 12 - 7 = 5 Friday

*Today is 1, Aug 1 = 5, Sept. 1=1, Oct. 1=3, Nov. 1 = 6, Dec 1 = 1, Dec.
25 = 5 .

My sample problem: (1+6+4) - [GINT(100/4) + 0] - 2 = 11 - 4 - 2 = 5 =
Friday.

We are consistent, but we may both be wrong.

Let's take a known problem: What day did March 24, 1993 fall on?
Answer: Wednesday = 3 .

Your sample problem: Aug 1 = 5, Jan 1 = 3, Mar 24 = 2.
2 - (1 + 1) - 4 = 3. OK
My sample problem: Jan 1, 1996 = 1, Mar 1, 1996 = 5, Mar 24, 1996 = 0
0 - (0 + 1) - 3 = 3 . OK

I think this is right, but one could check it as an exercise. I was
trying to learn to fake being an idiot savant!!! I may not be far off.

Best regards / Tom

P.S. Finally, I think I may have done *you* a favor.