Chapter 1 – Time (Day of the Week)

Measuring time, different calendars
Spectrum Calendar, prints a calendar for any year after 1582
Julian Date, works out the Julian Day number for any date
Julian Calendar, prints a complete Julian Day calendar for any month of any year
Day of the Week, identifies the day of the week for any date
Interval Days, the interval between any two dates from a few minutes to centuries apart
Local Sidereal Time, calculates ‘star time’ for any date and hour
Reaction Timer, find out your reaction time to get accurate readings.

Day of the Week

On what day of the week were you born?

When will Christmas Day next fall on a Thursday?

This simple program answers such problems by identifying any INPUT date against the day of the week – Sunday, Monday, etc. It is; ideal for incorporating into a longer program as a subroutine where the date is included.

9 REM ***********************
10 PRINT “Day of Week=”;
11 REM ***********************
30 LET d$=”SatSunMonTueWedThuFri”
40 INPUT “Year “;y'”Month “;m'”Day “;d: GO SUB 1000
160 LET q=j-7*INT (j/7)+1
170 LET e$=d$(3*q-2 TO 3*q)
300 PRINT d;”/”;m;”/”;y;”=”;e$;”day””: GO TO 1
1010 LET yy=y/100: LET y1=INT yy: LET yt=y/400: LET y4=INT yt
1030 LET j=d+INT (365.25*(y-(m<3)))+INT (30.6001*(m+1+12*(m<3)))-y1+y4+(yy=y1 AND yt<>y4 AND m<3): RETURN
9900 REM ***********************
9990 SAVE “DoW”

Sample output from the Day of the Week program

Day_of_the_Week



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s