This is how to calculate the day of the week for any given date.

For a date DD/MM/CCYY

  Y = ( YY + ( YY \ 4)) % 7
  D = DD
  M = [0,3,3,6,1,4,6,2,5,0,3,5](MM) 
  C =  (3 - ( CC  % 4 )) * 2
  A = LeapYear && (Jan | Feb) ? -1 : 0

  Day = ( Y + D + M + C + A ) % 7

  Weekday    Result
  ---------  ------
  Sunday       0
  Monday       1
  Tuesday      2
  Wednesday    3
  Thursday     4
  Friday       5
  Saturday     6

EG: Man landed on the moon on July 21, 1969 (21/7/1969)

  Y = ( 69  + (69 \ 4)) % 7 = (69 + 17) % 7 = 86 % 7 = 2
  D = 21
  M = 6
  C = ( 3 - ( 19 % 4)) * 2 = (3 - 3) * 2 = 0
  A = 0

  Day = ( 2 + 21 + 6 + 0 + 0 ) % 7 = 29 % 7 = 1 = Monday