|
...then my instructor was wrong... -----Original Message----- From: Joel Fritz [mailto:JFritz@sharperimage.com] Sent: Wednesday, May 16, 2001 11:28 AM To: 'RPG400-L@midrange.com' Subject: the seed date behind the curtain--RE: Can I get the Day of the we ek? The following link describes Zeller's Congruence--the formula below--which uses the date England adopted the Gregorian calendar as its seed. The sample problem on the web page assumes that the college is solvent. http://www.cs.unt.edu/~acm/hspc/samples/beg-P1.html > -----Original Message----- > From: Wills, Mike N. (TC) [mailto:MNWills@taylorcorp.com] > Sent: Wednesday, May 16, 2001 7:41 AM > To: 'RPG400-L@midrange.com' > Subject: RE: Can I get the Day of the week? > > > There is a mathematical formula for getting the day of the week: > > D = Day > M = Month > Y = the last two digits of the year > C = Century > > ((d + y) - (2 * c) + (y / 4) + (c / 4) + ((13 * m - 1) / 5)) % 7 = Day > > For the Day: 0 = Sunday, 1 = Monday, etc. > For some reason my program is a day off right now but I am > positive I had it > working before. I haven't taken the time to debug it yet. > This was done in > C++ on a PC. I need to double check my formula. > > But with this formula it doesn't depend on a known date. I > don't know if it > could cause problems, I just remember people keep on saying > to NOT hard-code > anything in if possible (although I am sure many of us do > anyway). This is a > formula that my instructor gave me and I have seen it on the > web. Then, if > you (for some weird reason) need a day from the 1600's you > can get it. > +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.