Strictly adhering to Lachman's Maxim (Complexity is a diseconomy of scale) this method is designed to run super-bly as a stand-alone subroutine when the most BASIC of computer is the only resource--meaning no values needed from user tables or system calls, no floating point variables and minimal operating system functionality beyond superBASIC as the command-line interpreter. Although using a processor more sophisticated than found on four-function calculators, this method is simple to execute using Hans' original Method. It succeeds where other Methods do not when computing the day of the week on lowly 8-bit-bus systems: having no need of extra instructions for data stored in tables, nor for redundant operations as in Zeller's--nor a C compiler running on a bloated development system as in Michael Keith's-- yet doing more in under 12 lines. Given: D$(1TO 8) as a date stamp CCYYMMDD in basic ISO format, N% as its Offset, & F% as a false flag for non-Gregorian calendars: 300 0 Julian (historical) 20300 0 Byzantine 325 0 Old-Style 300 50 Gregorian (historical); the superBASIC subroutine below is to compute: s$(1TO 2) as the offset century cc s$(1TO 4) as the offset year ccyy m$(2TO 3) as the MonthIndex i% as the increment to K% g% as the Gregorian adjustment w% as the mod 7 day-number compatible with ISO 8601: Sun=0 Mon=1 Tue=2 Wed=3 Thu=4 Fri=5 Sat=6. AUTO start,gap REM Step 0 - initialises parameters LET i%=F%+ F% : X%=256 : K%=19300 : s$=INT((D$-N%)/100) SELect ON N% ON N%= 20300 IF D$(5TO 6)> 8 THEN s$=s$- 100 IF s$(5TO 6)< 6 THEN i%=100 ON N%= 325 IF D$(5TO 8)< 0325 THEN LET i%=100 : IF D$(5TO 8)> 0300 THEN s$=s$+ 100 END IF ON N%= 300 g%=s$(1TO 2)DIV 8*F%+ F% ON N%= REMAINDER PRINT "N% invalid" END SELect REM Step 1 - initiates Lachman's Congruence LET m$=D$(5TO 6)*X%+ K%+ i% REM Step 2 - computes the day-number within the week LET w%=(s$(1TO 4)DIV 4+ D$(1TO 4)+ m$(2TO 3)+ D$(7TO 8)+ g%)MOD 7 ^space The subroutine is streamlined such that the proper parameters for a calendar are to be passed: for example, a flag of 50 for Gregorian dates as of 15.oct.1582 (A.D.) & 0 for non-Gregorian as of 1.jan.1001 (A.D. for Julian & Old Style calendars; A.M. for Byzantine calendars). The subroutine thereby gives compleat, valid, historical continuity of date-stamp-conversion until 31.dec.9999 for the relevant epoch. Because of its initial overlap with the historical year, the K% summand applies till December 31st. From January 1st, K%+i% applies till August 31st, the end of the Byzantine year, or March 24th, the end of the Old- Style year. Month-numbers remain defined in terms of an historical year for both (as for calendars where N%=300). -- REFERENCES http://terdina.net/ql/ql.html http://merlyn.demon.co.uk/zel-like.htm#Keith http://en.wikipedia.org/wiki/Zeller%27s_congruence gopher://gopherite.org/0/users/retroburrowers/TemporalRetrology/68k/y4k