SMOLNET PORTAL home about changes
 Strictly adhering to Lachman's Maxim (Complexity is a diseconomy of scale),
 this method is designed to run super-bly as a stand-alone routine when the
 the most BASIC of computer is the only resource--meaning minimal operating
 system functionality beyond superBASIC as a command-line interpreter, and
 no integer, nor floating point, variables.
 
 Although using a processor more sophisticated than found on four-function
 calculators and even on Tandy Color Computers, this method utilising Hans' 
 Phone Number Method is simpler to execute (having no need of C compilers)
 than the methods of Michael Keith and others.


Given:

D$    as a Date stamp CCYYMMDD in basic ISO format
T$    as an Offsets' table;

the superBASIC routine below is to compute:

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.

REM Step 0 - defines the Offsets' table, offsets the Date stamp:
LET T$="477358369472" : s$=D$(1TO 6)- 3

REM Step 1 - calculates contribution of the two-digit year:
LET z$=(s$(3TO 6)+ 3)*1.25+ 9997

REM Step 2 - computes the day-number within the week:
LET w$=(z$(1TO 3)+ T$(D$(5TO 6))+ D$(7TO 8)- (s$(1TO 2)&&3 *2))MOD 7

This routine is valid for Gregorian dates 15.oct.1582-31.dec.9999,
and can easily be coded for the 6809 CPU as used in the Tandy Color
Computer--nominally 8-bit yet still allows two 8-bit registers to be
combined into a 16-bit one in order to easily code Step 1 in BCD mode.

--

      REFERENCES

http://terdina.net/ql/ql.html
http://de.wikipedia.org/wiki/Wochentagsberechnung#Jahrhundertziffer
gopher://gopherite.org/0/users/retroburrowers/TemporalRetrology/cc/4g
Response: text/plain
Original URLgopher://sdf.org/0/users/retroburrowers/TemporalRetrology/QL/4G
Content-Typetext/plain; charset=utf-8