Method number 1:

Gregorian: h = (q + 26*(m+1)/10 + y + y/4 + 6y/100 + y/400) mod 7
Julian: h= (q + 26*(m+1)/10 + y + y/4 + 5) mod 7

h = week of day (0 is saturday, 1 is sunday, 6 is friday)
q = date
m = month number(March is 3, December is 12, January is 13, February is 14)
y = 4 digit year number

Method number 2:

a = (14 – month) / 12
y = year – a
m = month + 12*a – 2
For Julian calendar: d = (5 + day + y + y/4 + (31*m)/12) mod 7
For Gregorian calendar: d = (day + y + y/4 – y/100 + y/400 + (31*m)/12) mod 7

The value of d is 0 for a Sunday, 1 for a Monday, 2 for a Tuesday, etc.

We are following Georgian Calendar now. It’s better to verify this formula befoe using it.

Advertisements