Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!gatech!psuvax1!flee From: flee@shire.cs.psu.edu (Felix Lee) Newsgroups: comp.lang.c Subject: Re: Day of week routine Message-ID: Date: 22 May 89 23:20:00 GMT References: <234@zeek.UUCP> <322@xdos.UUCP> Sender: news@psuvax1.cs.psu.edu Distribution: usa Organization: Penn State University Computer Science Lines: 15 In-reply-to: doug@xdos.UUCP's message of 22 May 89 14:37:21 GMT In article <322@xdos.UUCP>, doug@xdos.UUCP (Doug Merritt) writes: >Try this: > ((year * 1.25) + (day-of-the-year) + constant) modulo 7 Using a strict interpretation of (day-of-the-year), you should use (year + (year-1)/4) instead of (year * 1.25). For the Gregorian calendar, try this instead: year + (year-1)/4 - (year-1)/100 + (year-1)/400. Note that not all countries adopted the Gregorian calendar at the same time. (Japan was quite late, something like 19th century?) -- Felix Lee flee@shire.cs.psu.edu *!psuvax1!shire!flee