Formula for the Day of the MonthDate: 04/05/2001 at 11:05:05 From: AJ Valadez Subject: Day of Week Formula I have read the Dr. Math FAQ on finding the day of the week from the date. The Calendar and the Days of the Week http://mathforum.org/dr.math/faq/faq.calendar.html How do you get the part of the equation that deals with the month? Date: 04/05/2001 at 13:39:09 From: Doctor Rob Subject: Re: Day of Week Formula Thanks for writing to Ask Dr. Math, AJ. Rev. Zeller came up with this formula about 200 years ago. Here is a partial explanation of why [(13*m-1)/5] appears. m Month # Days # Extra Total Extra ========================================== 1 March 31 3 0 2 April 30 2 3 3 May 31 3 5 4 June 30 2 8 5 July 31 3 10 6 August 31 3 13 7 September 30 2 16 8 October 31 3 18 9 November 30 2 21 10 December 31 3 23 11 January 31 3 26 12 February 28/29 0/1 29 Notice that the pattern in the 4th column repeats every 5 months, and the total number of extra days beyond 4*m weeks in one of those cycles is 3+2+3+2+3 = 13. That is why 13/5 appears in this part. Now look at 13*m/5, and its greatest integer (because the number of days is an integer): m 1 2 3 4 5 6 7 8 9 10 11 12 13*m/5 2.6 5.2 7.8 10.4 13 15.6 18.2 20.8 23.4 26 28.6 31.2 [13*m/5] 2 5 7 10 13 15 18 20 23 26 28 31 diff 3 2 3 3 2 3 2 3 3 2 3 ^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^ Notice the pattern 3,2,3,2,3 appearing in the differences, but at an offset from where we want it. This is almost the right set of numbers. It can be adjusted to be the right set by looking at X = [(13*m-1)/5] - 2: m 1 2 3 4 5 6 7 8 9 10 11 12 X 0 3 5 8 10 13 16 18 21 23 26 29 diff 3 2 3 2 3 3 2 3 2 3 3 ^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^ ^^^^^ Again, notice the 3,2,3,2,3 pattern appearing in the differences, but at the correct offset. That is what adding a constant in the numerator inside the brackets does: it shifts the difference pattern. Adding an integer outside the brackets leaves the difference pattern unchanged. This X duplicates the last column in the first table above. This means that [(13*m-1)/5] - 2 equals the contribution to the day of the week made by the month part of the date. - Doctor Rob, The Math Forum http://mathforum.org/dr.math/ |
Search the Dr. Math Library: |
[Privacy Policy] [Terms of Use]
Ask Dr. Math^{TM}
© 1994- The Math Forum at NCTM. All rights reserved.
http://mathforum.org/dr.math/