Re: Seeking someone smarter than me...
- Posted by Brian Broker <bkb at CNW.COM> Dec 13, 1999
- 431 views
On Mon, 13 Dec 1999 16:27:56 -0500, Brian Jackson <bjackson at 2FARGON.HYPERMART.NET> wrote: >Hi All, > >Does one of you college-type peoples happen to have the formula for >Zeller=92s Congruence Algorithm handy? I need it very badly, but I can't >find it anywhere on the web, and my dog ate my old homework... > >Brian Never heard of it... but being a resourceful college-type I managed to scrape up two different formulas: D is the day of the month. M is the month with March being 1 and January and February being months 11 and 12 of the previous year. C is the century. Y is the year. d is the day of the week with Sunday as 0 and Saturday as 6. d =3D ((26*M - 2)//10 + D + Y + Y//4 + C//4 - 2*C) mod 7 (// is integer division with truncation) ------------------------------------------------------ D =3D Day of the Month M =3D Month Y =3D Year (4 digits) Day of Week =3D (D + 2M + [3/5(M + 1)] + Y + [Y / 4] - [Y/100] + 2) mod 7 where square brackets denote the greatest integer function. The greatest integer function returns the largest integer that is less than or equal to the argument. For example [2.3] =3D 2, [100] =3D 100, [3.14159] =3D 3. Mod 7= is the remainder after dividing by 7. For example, 20 mod 7 =3D 6, 21 mod 7 =3D= 0. -------------------------------------------------------- I also found some examples in FORTRAN and C but I wouldn't want to pollute the Eu List with them. Junko has a Eu example at http://www.rapideuphoria.com/daybdate.zip