Article View: comp.lang.objective-c
Article #376Re: Calender program
From: Sven Pran
Date: Mon, 03 Feb 1997 00:00
Date: Mon, 03 Feb 1997 00:00
29 lines
1987 bytes
1987 bytes
Denver Curtis wrote: > > Looking for source for a calender program in any language preferabably C,C++, > You enter a date, it will tell you the day of the week this day falls on. > A very handsome algorithm valid for any year in the Gregorian calendar is: Function DOW(y,m,d : word)word; begin if m < 3 then begin m := m+12; y := y-1; end; DOW := (((3*m + 3) div 5) + 2*m + d + y + (y div 4) - (y div 100) + (y div 400)) mod 7; end; The answer is 0 for Monday through 6 for Sunday. I hope I got the typo correct! The algorithm showed up here a couple of months ago, I am sorry I don't remember the author, so I can't give him proper credit. regards Sven
Technical Details
Message-ID:
<32F59E6E.5675@alcatel.no>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<5d0e8p$5nc@news.mountain.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 110467,b8a1560d140abb5b X-Google-Attributes: gid110467,public X-Google-Thread: 10261c,b8a1560d140abb5b X-Google-Attributes: gid10261c,public X-Google-Thread: 111659,b8a1560d140abb5b X-Google-Attributes: gid111659,public X-Google-Thread: f8a86,b8a1560d140abb5b X-Google-Attributes: gidf8a86,public X-Google-Thread: f9adb,b8a1560d140abb5b X-Google-Attributes: gidf9adb,public X-Google-Thread: 10c950,b8a1560d140abb5b X-Google-Attributes: gid10c950,public X-Google-Thread: f461d,b8a1560d140abb5b X-Google-Attributes: gidf461d,public X-Google-Thread: 1111a3,b8a1560d140abb5b X-Google-Attributes: gid1111a3,public From: Sven Pran <Sven.Pran@alcatel.no> Subject: Re: Calender program Date: 1997/02/03 Message-ID: <32F59E6E.5675@alcatel.no> X-Deja-AN: 214078237 references: <5d0e8p$5nc@news.mountain.net> to: Denver Curtis <denverc@access.mountain.net> content-type: text/plain; charset=us-ascii organization: Alcanet International Scandinavia mime-version: 1.0 newsgroups: comp.lang.objective-c,comp.lang.pascal.ansi-iso,comp.lang.pascal.borland,comp.lang.pascal.misc,fido.ger.pascal,fido.pascal-ger,relcom.comp.lang.pascal,relcom.comp.lang.pascal.misc,slac.lang.pascal x-mailer: Mozilla 3.0 (Win95; I)