Studs Kreitzer - 2016-01-04

Hello,

Here's a day of the week function that might come in handy. It uses Zeller's congruence, which takes into account leap years. It has the same syntax as the Mathematica equivalent.

dayOfWeek(y,m,d):=([y, m: m-2, if m<1 then (m: m+12, y: y-1)], 
                  c: quotient(y,100), y: remainder(y,100),
                  w: remainder(d+y-2*c+quotient(y,4)+quotient(c,4)+quotient(13*m-1,5),7),

                  if w<0 then w: w+7,
                  if equal(w,0) then "Sunday"
                  elseif equal(w,1) then "Monday"
                  elseif equal(w,2) then "Tuesday"
                  elseif equal(w,3) then "Wednesday"
                  elseif equal(w,4) then "Thursday"
                  elseif equal(w,5) then "Friday"
                  else "Saturday"
                  )$

Studs Kreitzer