🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac
Article #4246

Re: Week DAYS (was Re: why 1904? ms excel)

#4246
From: Jeremy Roussak
Date: Fri, 08 Sep 1989 08:04
25 lines
1445 bytes
In article <972@mrsvr.UUCP> hallett@shoreland.UUCP (Jeff Hallett x4-6328) writes:
>Interesting.  One thing I've always wondered about, though, is, given
>a date in the Gregorian calendar, how does one determine the day of
>the week?  There is obviously a brute force approach, but does someone
>know (and will relate) an elegant solution?
>
>Thanks


The formulat I've always used is

dofw = ( |(2.6m-0.2)| + d + y + |y/4| + c + |c/4| ) mod 7

where d is the date
      y is the year in the century (ie this year is 89)
      c is the century (ie 19)
  and m is the month, but Jan and Feb are months 11 and 12 of the preceding
        year (so  Jan 89 is 11/88 and April 89 is 2/89)

I always forget whether 0 is Saturday or Sunday and have to calibrate
the formular using a date I know (today always seems a good idea).

Hope this helps

Jeremy Roussak
Technical Details
Message-ID: <1214@sequent.cs.qmc.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!mcsun!ukc!icdoc!qmc-cs!jeremyr
References: <457a7553.1285f@maize.engin.umich.edu> <8909061947.AA00416@vs04csc.UMD.EDU> <972@mrsvr.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!mcsun!ukc!icdoc!qmc-cs!jeremyr
From: jeremyr@cs.qmc.ac.uk (Jeremy Roussak)
Newsgroups: comp.sys.mac
Subject: Re: Week DAYS (was Re: why 1904?  ms excel)
Message-ID: <1214@sequent.cs.qmc.ac.uk>
Date: 8 Sep 89 08:04:14 GMT
References: <457a7553.1285f@maize.engin.umich.edu> <8909061947.AA00416@vs04csc.UMD.EDU> <972@mrsvr.UUCP>
Reply-To: jeremyr@cs.qmc.ac.uk (Jeremy Roussak)
Organization: Computer Science Dept, Queen Mary College, University of London, UK.
Lines: 25