Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!adm!xadmx!RDK%vm.temple.edu@cunyvm.cuny.edu From: RDK%vm.temple.edu@cunyvm.cuny.edu (Robert Keiser) Newsgroups: comp.lang.pascal Subject: Re: day-of-week algorithm Message-ID: <20771@adm.BRL.MIL> Date: 1 Sep 89 19:35:53 GMT Sender: news@adm.BRL.MIL Lines: 46 On 1 Sep 89 17:32:50 GMT you said: >I apologize if this has already been discussed, but I recently discovered >a point of confusion / error (gasp!) in the day-of-week algorithm posted >here several months ago. >This article appeared last April (1989): > ...omitted original message... > (* the above formula returns 0 for saturday, > 1 for sunday, > ... > 6 for friday. *) > This is interesting, When I run it on a Cyber it comes out with the following results: 0 = Sunday 1 = Monday ... 6 = Saturday I think that I just found the problem. I apologize for my original posting. The original algorithm was from a C book so no DIV function. The text that accompanied the algorithm clarified things. The function should look like this. N := ((1461 * F(Year,Month)) DIV 4) + ((153 * G(Month)) DIV 5) + Day; DOW := (N - 621049) MOD 7; When I wrote to the list I just pulled the comments but didn't look at the code that I wrote to go along with it. ... Rest of letter deleted. ... > >---Martin Thurn thurn@cis.ohio-state.edu 73747.224@compuserve.com > >Disclaimer: The preceding statements are n...Wait a minute! I AM the company! I'm suprised it took this long to show up. Robert Keiser Systems Analyst Temple University Computer Activities Bitnet : RDK@Templevm Internet : RDK@vm.temple.edu CompuServe : 73607.1047@Compuserve.com US Mail : Temple University Philadelphia, PA 19122