🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.asm370
Article #944

Re: leap years, julian date, and stuff.

#944
From: Bill Hecox
Date: Thu, 04 Jan 1990 18:43
35 lines
1648 bytes
>Since we're sort of on the subject, I have been looking for an algorithm
>to calculate the  day-of-week from the date. If anyone has this
>algorithm, could you please send me the pseudo code directly? I do
>not subscribe to this group. Thank you so much.  -Bob Peraino


I have always used this method.

The last two digits of the year
Plus the Julian day divided by 4 (round up)
Plus the julian day (1 to 366)
Divide all this by 7
Remainder of 0 = SAT
             1 = SUN


This method will work until Dec 31, 1999

The method works on the idea that the first day of this century was
a specific day of the week. Jan 1, 1900

The current year is added because there is one more day in each year
since 1900 then there is a multiple of seven. I.E. 7 X 52 = 364 + 1 = 365

The current year divided by 4 (rounded up) is used to account for the
extra day in each leap year since 1900.

The Julian day is added to account for the offset into the current year.

I would be interested in seeing other methods. Also methods that will
work past the end of the century.


Regards;
Bill Hecox
Technical Details
Message-ID: <9001041929.AA10370@brazos.rice.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!lll-winken!decwrl!ucbvax!SCFVM.BITNET!Z8WGH
References: <PERAINO@GMUVAX>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uwm.edu!lll-winken!decwrl!ucbvax!SCFVM.BITNET!Z8WGH
From: Z8WGH@SCFVM.BITNET (Bill Hecox)
Newsgroups: comp.lang.asm370
Subject: Re: leap years, julian date, and stuff.
Message-ID: <9001041929.AA10370@brazos.rice.edu>
Date: 4 Jan 90 18:43:05 GMT
References: <PERAINO@GMUVAX>
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: IBM 370 Assembly Programming Discussion List <ASM370%UCF1VM.BITNET@ricevm1.rice.edu>
Distribution: inet
Organization: The Internet
Lines: 35