<<< EISNER::DUA3:[NOTES$LIBRARY]ALGORITHMS.NOTE;1 >>> -< algorithms >- ================================================================================ Note 8.0 Day of the week 24 replies EISNER::HAHN "DECUServe Vice Chair" 15 lines 13-JAN-1990 09:27 -------------------------------------------------------------------------------- This little algorithm allows you to calculate the day of the week. I used it on an RT11 system to develop calendars. I originally came across it in BYTE (Sept 79 pp 126-129). It is entitled Zeller's Congruence. wkd = mod((int((26*mm-2)/10)+dd+yy+int(yy/4)+int(cc/4)-cc*2),7) now for the breakdown int = integer portion mod = modula yyyy = year (4 digits); if month is Jan or Feb then yyyy = yyyy - 1 cc = int (yyyy/4) yy = yyyy - cc*100 mm = month, where Mar = 1 .. Dec = 10, Jan = 11, Feb = 12 dd = day of the month wkd = day of the week 0 = Sunday ..