dim shared as ubyte fdoom(0 to 1, 1 to 12) = {_ { 3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5 }, _ { 4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5 } } 'the first doomsday in 'each month for common 'and leap years dim shared as string*10 days(0 to 6) = {"Sunday", "Monday", "Tuesday", "Wednesday",_ "Thursday", "Friday", "Saturday"} function doomsday(y as uinteger) as ubyte ' John Conway's doomsday formula return (2 + 5*(y mod 4) + 4*(y mod 100) + 6*(y mod 400)) mod 7 end function function leap(y as uinteger) as ubyte 'is it a leap year? 'return 0 for common years, 1 for leap years if y mod 4 > 0 then return 0 if y mod 100 = 0 and y mod 400 > 0 then return 0 return 1 end function function get_day(y as uinteger, m as ubyte, d as ubyte) as string dim as ubyte c = doomsday(y), diff diff = (7 + d - fdoom( leap(y), m )) mod 7 return days( (c+diff) mod 7 ) end function print get_day( 1800, 01, 06 ) print get_day( 1875, 03, 29 ) print get_day( 1915, 12, 07 ) print get_day( 1970, 12, 23 ) print get_day( 2043, 05, 14 ) print get_day( 2077, 02, 12 ) print get_day( 2101, 04, 02 )