Borg33414625035
Borg33414625035 on Hacker News
Re:Doomsday rule: calculate the day for any date
on Saturday August 16, 2014 @05:02AM (#8185748)
Here's my formula for D/M/Y where Y=YYYY=CCFS
(CC=century digits F=First S=Second digit of the last two digits in year)
Note:Only for Gregorian calendar.Formula= {D +Table(M) -1 IF month=1or2&leap_year +Table(CCmod4) +Table(F) +Table(S +2 IF F is odd) } mod7
Tables are:
Month {033614625035} or Jan=0 Feb=3 Mar=3 Apr=6 etc.
Century {6420} or 16xx=6 17xx=4 18xx=2 19xx=0 20xx=6 etc.
TableFirst memorize {0340145025} or {00,13,24,30,41,54,65,71,82,95}
TableSecond memorize {012356013456} or {00,11,22,33,45,56,60,71,83,94,105,116}
FormulaResultTable:1=Monday...6=Saturday 0=Sunday
Example: 16 August 2014 = (16+2+6+3+0)mod7=6=SaturdayIn this method,I find slight advantage over "odd+11 method" because my method does not involve two digit arithmetric (and memorizing running total if you're not calculating FS first),although learning tables take some time.