Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!caip!clyde!cbatt!cbosgd!ihnp4!ihwpt!crocker From: crocker@ihwpt.UUCP (ron crocker) Newsgroups: net.unix Subject: Re: Dates and Times Message-ID: <1084@ihwpt.UUCP> Date: Thu, 4-Sep-86 22:03:31 EDT Article-I.D.: ihwpt.1084 Posted: Thu Sep 4 22:03:31 1986 Date-Received: Fri, 5-Sep-86 19:46:18 EDT References: <3507@brl-smoke.ARPA> Organization: AT&T Bell Laboratories Lines: 50 > Is there also a simple routine that will allow me to calculate > what day of the week an arbitrary date falls on? This is from the back of my calendar, and it still sounds like magic to me, but it works... (From "The Ready Reference (r) Weekly Planner 1986 ((c) 1986 Ready Reference) "To Find Day of Week of Any Date This formula is correct for any date after September 14, 1752 EXAMPLE - WHAT DAY OF WEEK WAS JANUARY 10th, 1946? (1) Take the last two digits of the year [46] (2) Add a quarter of this number, neglecting any remainder [11] (3) Add the date in the month [10] (4) Add according to the month - [ 1] Jan - 1 (Leap: 0) May - 2 Sept - 6 Feb - 4 (Leap: 3) June - 5 Oct - 1 Mar - 4 July - 0 Nov - 4 Apr - 0 Aug - 3 Dec - 6 (5) Add for the Century - [ 0] 18th - 4 19th - 2 20th - 0 21st - 6 [Total: 68] (6) Divide total by 7 - Remainder gives the day [68mod7 = 5] 1 - Sunday 2 - Monday 3 - Tuesday 4 - Wednesday 5 - Thursday 6 - Friday 7 - Saturday ANSWER - THURSDAY" Ok, so it's magic. It seems to work. For later than 21st century, I would suggest trial/error method - there are only 7 choices... -- Ron Crocker AT&T Bell Laboratories Room IH 6D535 Naperville-Wheaton Road Naperville, IL 60566 (312) 979-4051