xerr = 0
FDay$ = ""
Main_Menu
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹" Print "º 0. CalenTools only works for years between 1583 and 3266 inclusive. º" Print "º See why, and read about Julian Day numbers and ISO week numbers. º" Print "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" Print "º 1. Add or Subtract days from a date. º" Print "º 2. Calendars for a month and/or a year. º" Print "º 3. Day of week e.g., 1968-03-17 was a Sunday. º" Print "º 4. Day of week repetitive e.g., what years following 1968 was 03-17 a Sunday.º" Print "º 5. Day of year number from date e.g., 1968-03-17 was 77th day of the year. º" Print "º 6. Date from day of year number e.g., in 1968 77th day was 03-17. º" Print "º 7. Difference between two dates in Years Months and Days. º" Print "º 8. Find Easter day. º" Print "º 9. Date to Julian Day number. º" Print "º A. Julian Day number to date. º" Print "º B. Was/is/will it be a Leap Year. º" Print "º c. Week number of the year (this is ISO week numbers). º" Print "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" Print "º Q. To Quit. You can also quit from any other prompt by entering Q. º" Print "ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹" Print "º Enter the number/letter of your choice: º" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Case "9": Start_Date_to_JD
Case "a": Start_JD_to_Date
Case "b": Start_Leap_Year
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Add or Subtract Days ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Input " Are you Adding to or Subtracting from a date (A/S)"; q$
OpWd$ = " plus "
xWd$ = "add"
yWd$ = "add to"
OpWd$ = " minus "
xWd$ = "subtrtact"
yWd$ = "subtrtact from"
Done
Print " You must enter 'A' for adding or 'S' for subtracting." Input " Press 'Enter' to continue."; q$
Start_ASD
Print " Enter the number of days you want to "; xWd$;
":";:
Input " ", ND$
Print " Enter date to "; yWd$;
" (yyyy-mm-dd)";:
Input " ", Dt$
Date_to_YMD
If xerr
= 1 Then xerr
= 0: Start_ASD
Date_to_JD
JDs = JD
JD = JDs + ND
JD = JDs - ND
JD_to_Date
Zellers
Day_Names_Long
YMD_to_Str
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_ASD
Cals
Get_1st_Day
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Calendars ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Print " Do you wish weeks to start on Sunday or Monday. Your choice will be" Print " remembered until you quit, unless you change it in the Calendar menu." Done
Cals
Get_1st_Day
Locate 1, 18:
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Locate 3, 18:
Print "ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹" Locate 6, 18:
Print "º 3. A month in a dIfferent year º" Locate 9, 18:
Print "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" Locate 12, 18:
Print "º S. Save 1st day of week to disc º" Locate 13, 18:
Print "ÇÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄĶ" Locate 15, 18:
Print "ÌÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ͹" Locate 16, 18:
Print "º Enter the number/letter of your choice: º" Locate 17, 18:
Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Make_Month
Print " Enter a month number between 1 and 12." Input " Press 'Enter' to continue. ", q$
Cals
Make_Month
Locate 18, 19:
Input " Enter a year and month yyyy-mm: ", Dt$
Print " Enter a 4 digit year '-' 2 digit month, e.g., yyyy-mm" Input " Press 'Enter' to continue. ", q$
Cals
Print " You must enter year from 1583 to 3266 and a month from 1 - 12." Input " Press 'Enter' to continue. ", q$
Cals
Make_Month
Make_Year
Print " Enter a year between 1583 and 3266." Input " Press 'Enter' to continue. ", q$
Cals
Make_Year
Get_1st_Day: Cals
Main_Menu
Save_1st_Day
Done
Cals
Locate row
- 1, 1:
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_Cals
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" row = 3
col = 30
d = 1
Make_Cal
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" row = 3
m = 1
d = 1
nm = m
col = 5
Make_Cal
nm = nm + 1
d = 1
m = nm
row = row - 8
col = col + 25
row = row + 9
Zellers
n2 = dow
Day_Of_Year
n1 = doy: m1 = m
m = m + 1
n3 = 31
Day_Of_Year: n3 = doy - n1
m = m1
Month_Names_Long
row = row + 1
row = row + 1
dn = 0
' This sets up printing "Gray Days"
DM = m1
Days_In_Month
GD = dlm - n2 + 1
aGD = 1
' Print the calendars
C = col
g = 1
wkd = 0
s = C
aGD = aGD + 1
dn = dn + 1
dn = dn + 1
dn = dn + 1
wkd = wkd + 1
C = C + 3
g = g + 1
GD = GD + 1
row = row + 1
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Day of Week ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Print " Enter date to check (yyyy-mm-dd)";:
Input Dt$
Date_to_YMD
If xerr
= 1 Then xerr
= 0: Start_DoW
Zellers
Day_Names_Long
YMD_to_Str
Print " "; Dt$;
" was/is/will be a "; WkDa$
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_DoW
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Day of Week Repetitive ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Print " Enter date to start checking at (yyyy-mm-dd)";:
Input Dt$
Date_to_YMD
If xerr
= 1 Then xerr
= 0: Start_DoWR
Print " Do you want to check until today or for a given number of years?" Input " Press 0 for today or a (positive) number up to 250 "; YrCt$
YrCt = 250
Zellers
b = dow
Print " Date Day YrNo Count" row = 10
col = 23
x = 0
C = 0
Zellers
Day_Names_Short
C = C + 1
row = row + 1
x = x + 1
y = y + 1
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_DoWR
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Day of Year ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Input " Enter a date, e.g. 1969-07-20 (yyyy-mm-dd): "; Dt$
Date_to_YMD
If xerr
= 1 Then xerr
= 0: Start_DoY
Day_Of_Year
YMD_to_Str
Print " "; Dt$;
" was/is/will be day number "; doy
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_DoY
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Reverse Day of Year ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Input " Enter year and day number, 1969-074 (yyyy-nnn): "; Dt$
Print " You need a 4 digit year '-' 3 digit day number: yyyy-nnn." Input " Press 'Enter' to continue. ", q$
Start_RDoY
Print " Enter a year between 1583 and 3266." Input " Press 'Enter' to continue. ", q$
Start_RDoY
Leap_Year
diy = 365
diy = 366
Print " You need day of year number between 1 and "; diy
Input " Press 'Enter' to continue. ", q$
Start_RDoY
d = doy + 2 - LY
d = doy
m = 100 * (d + 91) \ 3055
d = d + 91 - (3055 * m \ 100)
m = m - 2
Zellers
Day_Names_Long
Month_Names_Long
YMD_to_Str
Print " For day number"; doy;
"of"; y$;
" the date was/is/will be "; WkDa$;
", "; MoNa$; d$
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_RDoY
Print "ÉÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍͼ Difference Between Dates in Years, Months, and Days ÈÍÍÍÍÍÍÍÍÍÍͼ"
Input " Enter first date (yyyy-mm-dd)"; Dt$
Date_to_YMD
If xerr
= 1 Then xerr
= 0: Start_DYMD
Yr1 = y
Mo1 = m
Da1 = d
Dt1$ = Dt$
Date_to_JD
JD1 = JD
Input " Enter second date (yyyy-mm-dd)"; Dt$
Date_to_YMD
If xerr
= 1 Then xerr
= 0: Start_DYMD
Yr2 = y
mo2 = m
da2 = d
Dt2$ = Dt$
Date_to_JD
JD2 = JD
' Determine which Date/JD is larger.
LrJD = JD1
LrYr = Yr1
LrMo = Mo1
LrDa = Da1
LrDt$ = Dt1$
SmJD = JD2
SmYr = Yr2
SmMo = mo2
SmDa = da2
SmDt$ = Dt2$
LrJD = JD2
LrYr = Yr2
LrMo = mo2
LrDa = da2
LrDt$ = Dt2$
SmJD = JD1
SmYr = Yr1
SmMo = Mo1
SmDa = Da1
SmDt$ = Dt1$
' Find the difference between the two dates in days.
OpJD = LrJD - SmJD
' Find the Days, Months, and Years between the two dates.
' Find Days
OpDa = 0
OpDa = LrDa - SmDa
DM = LrMo
y = LrYr
Days_In_Month
OpDa = LrDa + dlm - SmDa
LrMo = LrMo - 1
'find Months
OpMo = 0
OpMo = LrMo - SmMo
OpMo = LrMo + 12 - SmMo
LrYr = LrYr - 1
'find Years
OpYr = 0
OpYr = LrYr - SmYr
Print " The difference between "; SmDt$;
" and "; LrDt$;
" is:" Print " or"; OpYr;
"Years,"; OpMo;
"Months, and"; OpDa;
"Days," Print " or"; OpYr
* 12 + OpMo;
"Months and"; OpDa;
"Days," Print " or"; OpJD \
7;
"Weeks and"; OpJD
Mod 7;
"Days." Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_DYMD
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Find Easter ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Input " Enter a year yyyy: ", y$
Print " Enter a year between 1583 and 3266." Input " Press 'Enter' to continue. ", q$
Start_RDoY
P = (y \ 100)
Q = ((13 + 8 * P) \ 25)
m
= (15 - Q
+ P
- P \
4) Mod 30 n
= (4 + P
- P \
4) Mod 7 E
= (2 * B
+ 4 * C
+ 6 * d
+ n
) Mod 7 day = (22 + d + E)
m = 4
d = 19
m = 4
d = 18
m = 4
d = day - 31
m = 3
d = day
Month_Names_Long
Print " In"; y;
"Easter was/is/will be on Sunday, "; MoNa$; day$
Date_to_JD
JD = JD - 47
JD_to_Date
YMD_to_Str
Month_Names_Long
Print " And Mardi Gras was/is/will be on Tuesday, "; MoNa$; d$
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_Easter
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Date to Julian Day Number ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Input " Enter a date yyyy-mm-dd: ", Dt$
Date_to_YMD
If xerr
= 1 Then xerr
= 0: Start_Date_to_JD
Date_to_JD
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_Date_to_JD
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Julian Day Number to Date ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Input " Enter a number between 2299239 (1583-01-01) and 2914307 (3266-12-31): ", JD$
Print " You entered "; JD$;
" This is an incorrect value for the JD number." Input " Press 'Enter' to continue. ", q$
Start_JD_to_Date
JD_to_Date
Zellers
Day_Names_Long
YMD_to_Str
Print " "; JD$;
" is the Julian Day Number for "; WkDa$
+ y$
+ "-" + LTrim$(m$
) + "-" + LTrim$(d$
) Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_JD_to_Date
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Leap Year ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Input " Enter a year yyyy: ", y$
Print " Enter a year between 1583 and 3266." Input " Press 'Enter' to continue. ", q$
Start_Leap_Year
Leap_Year
ly$ = "Yes"
lyw$ = "was/is/will be"
ly$ = "No"
lyw$ = "wasn't/isn't/won't be"
Print " "; ly$;
" "; y$;
" "; lyw$;
" a Leap Year." Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_Leap_Year
Print "ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍËÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»" Print "ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ Week Number ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ" Input " Enter a date yyyy-mm-dd: ", Dt$
Date_to_YMD
If xerr
= 1 Then xerr
= 0: Start_WkNo
lwn
= (y
+ (y \
4) - (y \
100) + (y \
400)) Mod 7
Zellers
Day_Of_Year
WN = (10 + doy - dow) \ 7
yy = y: y = y - 1
mm = m: m = 1
dd = d: d = 1
Zellers
Leap_Year
WN = 53
WN = 53
WN = 52
y = yy: m = mm: d = dd
Zellers
Day_Names_Long
Print " "; Dt$;
" is "; WkDa$;
" of week number";
RTrim$(WN$
);
","; y
Zellers
Day_Names_Long
WN = 1
y = y + 1
Print " "; Dt$;
" is "; WkDa$;
" of week number";
RTrim$(WN$
);
","; y
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Again: Start_WkNo
' ================================================================================
' common SUBs used by other routines
' ================================================================================
Dt$ = ""
y = 0
m = 0
d = 0
JD = 0
Locate row
, 1:
Input " Enter 'A' to go again, 'M' for main menu, or 'Q' to quit (A/M/Q)"; q$
Main_Menu
Done
' Gives the day of week for any Gregorian calendar date.
mz = m - 2: yz = y
mz = m + 10: yz = y - 1
cz = yz \ 100: dz = yz - 100 * cz
dow = ((13 * mz - 1) \ 5) + d + dz + (dz \ 4) + (cz \ 4) - cz - cz + 77
dow = dow - 7 * (dow \ 7)
' Gives the day of the year
doy = (3055 * (m + 2) \ 100) - 91
Leap_Year
If m
> 2 Then doy
= doy
- 2 + LY
doy = doy + d
LY = 0
' Get the number of days for last month (dlm), this month (dtm), and next month (dnm)
Leap_Year
DM1 = DM * 2 - 1
dlm
= Val(Mid$("313128313031303131303130", DM1
, 2)) dtm
= Val(Mid$("312831303130313130313031", DM1
, 2)) dnm
= Val(Mid$("283130313031313031303131", DM1
, 2))
' Convert a Gregorian Date to a Julian Day number.
JD = d - 32075 + (1461 * (y + 4800 + ((m - 14) \ 12)) \ 4) + 367 * (m - 2 - ((m - 14) \ 12) * 12) \ 12 - 3 * ((y + 4900 + ((m - 14) \ 12)) \ 100) \ 4
' Convert a Julian Day number to a Gregorian Date.
L = JD + 68569
n = 4 * L \ 146097
L = L - (146097 * n + 3) \ 4
y = 4000 * (L + 1) \ 1461001
L = L - (1461 * y \ 4) + 31
m = 80 * L \ 2447
d = L - (2447 * m \ 80)
L = m \ 11
m = m + 2 - (12 * L)
y = 100 * (n - 49) + y + L
Case 2: WkDa$
= "Tuesday" Case 3: WkDa$
= "Wednesday" Case 4: WkDa$
= "Thursday" Case 6: WkDa$
= "Saturday"
Case 1: MoNa$
= "January" Case 2: MoNa$
= "February" Case 9: MoNa$
= "September" Case 10: MoNa$
= "October" Case 11: MoNa$
= "November" Case 12: MoNa$
= "December"
' Convert input date (Dt$) to year, month, and day integers And check that they are valid
DM = m
Days_In_Month
Print " Your date has too few or too many characters in it." Input " Press 'Enter' to continue. ", q$
xerr = 1
Print " Enter a year between 1583 and 3266." Input " Press 'Enter' to continue. ", q$
xerr = 1
Print " Enter a month number between 1 and 12." Input " Press 'Enter' to continue. ", q$
xerr = 1
Print " Enter a day number between 1 and "; dtm;
Input " Press 'Enter' to continue. ", q$
xerr = 1
' Convert Year, month, and day integers to strings and add leading 0s to digits less than 10
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Print " CalenTools will not work with years prior to 1583 or after 3266, this was" Print " done intentionally partly as an error prevention measure." Print " Prior to 1583 most of the western world used the Julian Calendar which had" Print " an extra 3 leap years every 400 years. Pope Gregory XIII wrote a papal bull" Print " in Feb. 1582 to correct for this error by suppressing 10 days. Thus causing" Print " Oct. 5, 1582 to become Oct. 15, 1582. (So I dropped the last two and a half" Print " months of 1582 because and I don't think most people will need them)." Print " The papel bull was adopted by most countries at different times. A lof of" Print " Roman Catholic countries Spain, Portugal, etc. and their colonies changed on" Print " Oct. 15, 1582. Great Britain and the American colonies changed in 1752. The" Print " most recant change from The Julian calendar that I know of is Turkey in 1927." Print " As Far as I know only a few religions still use the Julian calendar. You" Print " can use the search engine of your choice to find a list of when the different" Print " countries adopted the Gregorian calendar." Print " As for after 3266, it my be my limited sense of reality, but I don't really" Print " think it's necessary as I think there will be something better by then. Maybe" Print " even a whole new calendar system. " Print " Also it's the end of the first Julian Period so Julian Day numbers will" Print " restart at one. I'm using Julian Day numbers are here to 'Add or Subtract" Print " Days' and to find the 'Difference between two dates'." Print " The Julian Period and Julian Day numbers (not to be confused with the" Print " Julian Calendar) start at noon on -4712-01-01 of the Julian calendar (or" Print " -4713-11-24 Gregorian Calendar). This is because in 4713 BC the 'Indiction'" Print " (15 yrs.), the 'Golden Number' (19) and the 'Solar Number' (28 yrs.) were all" Print " one. The Julian Period is 7980 years long. The next time this happens is" Print " Jan. 01, 3268 Julian calendar or Nov. 24, 3267 Gregorian calendar." Print "ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ" Print " The ISO (International Organization for Standardization) week starts on" Print " Mon. The 1st week of the year has Jan. 4th and the first Thu. of the year in" Print " it. If Jan. the 1st is a Thu., making Sun. the 4th the last day of the week," Print " the first day of the first week is Mon. Dec. 29th of the previous year. If" Print " Jan. 4th is a Mon. then Jan. 1st is Fri. of the last week of the previous year." Print " Also a year that starts on Thu. (or Wed. if a leap year) has 53 weeks" Print " because there are 53 Thu. in the year and therefore 53 continuous weeks that" Print " each have at least 4 days of the current calendar year per week. Therefore," Print " Fri. Jan. 1st 2016 is Fri. of the 53rd week of 2015." Print " There are 71 of these 53 week years every 400 years." Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Input " Press 'Enter' to continue. ", q$
Done
Main_Menu
Print "ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ" Print " Saving this will create a 3 byte file on your hard drive. This file will" Print " waste a lot of space. Depending on drive size and operating system you are" Print " wasting, on average, between 509 to 4093 bytes. Just to save you from having" Print " to press 's' or 'm' every time you view calendars in CalenTools." Print " The file it creates will be in the same directory that you have CalenTools in." Print " So if you have it on the desktop you will end up with two CalenTools files on" Print " your desktop. Also if for whatever reason you happen to have a file named" Print " 'calentools.dat' in the same directory it will be over written." Input " Do you wish to continue (Y/N)"; q$
Done
Cals
Do_Save
Save_1st_Day
fd$ = FDay$ 'This is in case you are using Sun. but want to save Mon.
Input " Do you want the week to start on Sunday or Monday (S/M)"; q$
FDay$ = q$
FDay$ = fd$
Cals