0

i've solved most of the day finding problems using zellers formulae $$ Z= K + \frac{13M -1}{5} + D +\frac{D}{4} + \frac{C}{4} - 2C $$ where

  • $K$ = given
  • $M$ = given month no. ( but here month count starts from march )
  • $D$ = last 2 digits of the given year ( but $D = D-1$ if given month is Jan or Feb )
  • $C$ = first 2 digits of the given year.

but it is not working for the find the day 01,march,2014?

Dario
  • 5,749
  • 2
  • 24
  • 36

1 Answers1

2

As posted, there is a typo and you forgot the floor operations.

For the Gregorian calendar, Zeller's original congruence formula is $$Z= K + \lfloor \frac{13M +1}{5}\rfloor + D + \lfloor \frac{D}{4}\rfloor + \lfloor\frac{C}{4}\rfloor - 2C~~~~~~\mod7$$ Applying it to $1^{st}$ $\text {march}$ $2014$ gives $Z=-7$ that is to say $0$ which means a saturday, which is correct.

Do not forget the floor functions.

Siong Thye Goh
  • 149,520
  • 20
  • 88
  • 149
  • http://www.careeranna.com/zellers-rule-find-the-day-for-any-date-quickly/ but in the above link it shows 13M-1 instead of 13M+1 and 0 is for sunday instead of saturday – InstanceDeveloper Jun 28 '14 at 12:10
  • OK. In what I gave you $march=3$, $april=4$, ..,$january=13$, $february=14$. This is why we have a shift in the formula but both are correct. Have a look at http://en.wikipedia.org/wiki/Zeller's_congruence#Examples – Claude Leibovici Jun 28 '14 at 12:23