[comp.sources.wanted] Need Routine to Calculate Day of Week

debby@jetson.UPMA.MD.US (Debby Hillman) (01/11/89)

I need source code, preferably in C, which will calculate the day
of week for any day/month/year, or, equivalently, the day of the
week any month starts with.

Please email any replies to uunet!jetson!debby or debby@jetson.UPMA.MD.US.

Thanks in advance,
Debby

swh@hpsmtc1.HP.COM (Steve Harrold) (01/12/89)

Re: day-of-week code

Sorry, no source, but here's the outline:

Insert the day/month/year into a tm struct, and call mktime().
The result, when divided by 86400L (60*60*24) gives number of days
since Jan 1, 1970.  Find out what day of week the 1/1/70 date was
and add it to the result.  A simple modulo 7 calculation will now tell
you what day of week your desired date is.