Days of the Week

 BBS: Inland Empire Archive
Date: 08-08-92 (19:11)             Number: 121
From: BILL CAMPBELL                Refer#: NONE
  To: AL LAWRENCE                   Recvd: NO  
Subj: Days of the Week               Conf: (2) Quik_Bas
' This program can only work for years 1901 to 2099 because
the ' years 1900 and 2100 are not leap years. I could fix
this but -' WHY ? I won't be here to take the fall for
problems encouterred ' in 2100 !

usedate$ = DATE$
CLS
PRINT "         (I)nput your own date    or    (U)se today's date" x$ = ""
DO: x$ = INKEY$
        IF x$ = "I" OR x$ = "i" OR x$ = "U" OR x$ = "u" THEN EXIT DO LOOP
IF x$ = "i" OR x$ = "I" THEN
   LOCATE 2, 1
   PRINT "DAY - MONTH - YEAR"
   PRINT "##     ##     ####"
   ROW = 3: mydate$ = "": column = 1: flag = 0: SETLENGTH = 8
   LOCATE 3, 1: COLOR 12, 0
BuildDate:
   select$ = ""
   DO WHILE select$ <> CHR$(13) AND flag < SETLENGTH
        select$ = INKEY$
        IF flag = 0 THEN
                column = 1
        ELSEIF flag = 1 THEN
                column = 2
        ELSEIF flag = 2 THEN
                column = 8
        ELSEIF flag = 3 THEN
                column = 9
        ELSEIF flag > 3 THEN
                column = flag + 11
        END IF
        IF flag = 0 AND select$ > "3" THEN GOTO BuildDate
        IF flag = 2 AND select$ > "1" THEN GOTO BuildDate
        IF flag = 4 AND select$ > "2" THEN GOTO BuildDate
        IF select$ > CHR$(47) AND select$ < CHR$(58) THEN GOTO GotChar
        GOTO BuildDate
GotChar:
        LOCATE ROW, column: PRINT select$
        flag = flag + 1: mydate$ = mydate$ + select$
        IF flag = 2 OR flag = 4 THEN mydate$ = mydate$ + "-"
   LOOP
   PRINT "mydate$ = "; mydate$
   usedate$ = mydate$
END IF

COLOR 7, 0
DIM days$(7)
days$(1) = "Sunday":     days$(2) = "Monday":    days$(3) =
"Tuesday" days$(4) = "Wednesday":  days$(5) = "Thursday":
days$(6) = "Friday" days$(7) = "Saturday"

DIM month$(12, 2)
month$(1, 1) = "January":   month$(1, 2) = "31"
month$(2, 1) = "February": month$(2, 2) = "28"
month$(3, 1) = "March":     month$(3, 2) = "31"
month$(4, 1) = "April":     month$(4, 2) = "30"
month$(5, 1) = "May":       month$(5, 2) = "31"
month$(6, 1) = "June":      month$(6, 2) = "30"
month$(7, 1) = "July":      month$(7, 2) = "31"
month$(8, 1) = "August":    month$(8, 2) = "31"
month$(9, 1) = "September": month$(9, 2) = "30"
month$(10, 1) = "October":  month$(10, 2) = "31"
month$(11, 1) = "November": month$(11, 2) = "30"
month$(12, 1) = "December": month$(12, 2) = "31"

' The first day of the year can only fall on one of seven
choices ' which will set the sequence for the rest of the
year.
' Each of those choices may or may not fall in a leap year
thus ' doubling your possible yeartypes to 14.

DIM DayYearStarted$(14)
' 1 = sunday and 7 = saturday as per the array days$
FOR startday = 1 TO 7
        DayYearStarted$(startday) = days$(startday)
        DayYearStarted$(startday + 7) = days$(startday)
NEXT startday


--- Maximus 2.00
 * Origin: Durham Systems (ONLINE!) (1:229/110)
Outer Court
Echo Basic Postings

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