BBS: Inland Empire Archive Date: 08-08-92 (19:12) Number: 122 From: BILL CAMPBELL Refer#: NONE To: AL LAWRENCE Recvd: NO Subj: Days of the Week part 2 Conf: (2) Quik_Bas
'1901 started on yeartype 3 and the repeating sequence for
yeartypes is : ' 3 4 5 13 1 2 3 11 6 7 1 9 4 5 6 14 2 3 4
12 7 1 2 10 5 6 7 8
DIM yearsequence(28)
yearsequence(1) = 3 ' if year = 1901 then use
yearsequence(1) yearsequence(2) = 4 ' if year = 1902
then use yearsequence(2) yearsequence(3) = 5 ' if year
= 1903 then use yearsequence(3) yearsequence(4) = 13
yearsequence(5) = 1: yearsequence(6) = 2: yearsequence(7) = 3
yearsequence(8) = 11: yearsequence(9) = 6:
yearsequence(10) = 7 yearsequence(11) = 1:
yearsequence(12) = 9: yearsequence(13) = 4
yearsequence(14) = 5: yearsequence(15) = 6:
yearsequence(16) = 14 yearsequence(17) = 2:
yearsequence(18) = 3: yearsequence(19) = 4
yearsequence(20) = 12: yearsequence(21) = 7:
yearsequence(22) = 1 yearsequence(23) = 2:
yearsequence(24) = 10: yearsequence(25) = 5
yearsequence(26) = 6: yearsequence(27) = 7:
yearsequence(28) = 8
year = VAL(RIGHT$(usedate$, 4)) ' determine yeartype
IF year MOD 4 = 0 THEN leap = -1
year = year - 1900
whichyeartype = year MOD 28
PointerToDayYearStarted = yearsequence(whichyeartype)
startdayvalue = PointerToDayYearStarted
IF startdayvalue > 7 THEN startdayvalue = startdayvalue - 7
startday$ = DayYearStarted$(PointerToDayYearStarted)
PRINT "This year started on a "; startday$
' compute number of days this year
numofcompletemonths = VAL(MID$(usedate$, 4, 2)) - 1
FOR countmonths = 1 TO numofcompletemonths
numofdays = numofdays + VAL(month$(countmonths, 2)) NEXT countmonths
numofdays = numofdays + VAL(LEFT$(usedate$, 2))
IF leap THEN
PRINT "LEAP YEAR !!"
IF VAL(MID$(usedate$, 4, 2)) > 1 THEN
IF VAL(MID$(usedate$, 4, 2)) > 2 OR VAL(LEFT$(usedate$, 2)) > 28 THEN
PRINT "LEAP YEAR COUNTED!!"
numofdays = numofdays + 1
END IF
END IF
END IF
PRINT "Number of days this year so far is "; numofdays
whatday = (numofdays MOD 7) - 1
whatday = whatday + startdayvalue
IF whatday > 7 THEN whatday = whatday - 7
thisday$ = days$(whatday)
thismonth$ = month$(VAL(MID$(usedate$, 4, 2)), 1)
calendardate$ = LEFT$(usedate$, 2)
thisyear$ = RIGHT$(usedate$, 4)
PRINT "Today is "; thisday$
PRINT "Today's date is "; usedate$
PRINT "Which translates to ";
PRINT thisday$ + " " + thismonth$ + " " + calendardate$ + ", " + thisyear$
--- Maximus 2.00
* Origin: Durham Systems (ONLINE!) (1:229/110)

Books at Amazon:
Back to BASIC: The History, Corruption, and Future of the Language
Hackers: Heroes of the Computer Revolution (including Tiny BASIC)
Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution
The Advent of the Algorithm: The Idea that Rules the World
Moths in the Machine: The Power and Perils of Programming
Mastering Visual Basic .NET