Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
which day of the week
#23
Hope to clear things up a bit with this Columbus Day demo, but short answer... When was Columbus Day in 1492? No day... It hadn't been invented until 1971. Big Grin

Anyway, the demo shows all leap years in yellow, non in white. It shows the difference in calendar days for each year, 365 or 366 (except the first year, 1492). What you will notice that unless it is a leap year the progression is the next day each year. On a leap year it skips to the day after next. The pattern proves if the algorithm used is correct.

Code: (Select All)
' Columbus Day "Day of the Week" from 1492 on...
' Using Gregorian calendar algorithm, which was not available (invented) until 1582.
Width 80, 43
_ScreenMove 0, 0
map$ = "Sunday    Monday    Tuesday  Wednesday Thursday  Friday    Saturday"
year = 1492
month = 10
Rem January = 0, February = 31,March = 59, April = 90, May = 120, June = 151, July = 181, August = 212,,September = 243, October = 273, November = 304 and December = 334
oct = 273
day = 12
Do
    leapyear = 0
    ans = (365 * year) + year \ 4 - year \ 100 + year \ 400 - 365
    If year Mod 4 = 0 And year Mod 100 Or year Mod 4 = 0 And year Mod 100 = 0 And year Mod 400 = 0 Then leapyear = 1
    If leapyear And month < 3 Then ans = ans - 1
    ans = ans + oct + day
    dow = ans Mod 7
    If leapyear Then Color 14 Else Color 7
    Print year, ans, ans - oldans, "Oct 12,"; year; "falls on a " + Mid$(map$, 10 * dow + 1, 10)
    year = year + 1
    oldans = ans
    Sleep
Loop

Pete
Shoot first and shoot people who ask questions, later.
Reply


Messages In This Thread
which day of the week - by macalwen - 12-30-2024, 01:17 PM
RE: which day of the week - by SpriggsySpriggs - 12-30-2024, 03:12 PM
RE: which day of the week - by bplus - 12-30-2024, 03:16 PM
RE: which day of the week - by eoredson - 01-02-2025, 02:15 AM
RE: which day of the week - by Pete - 01-02-2025, 03:16 AM
RE: which day of the week - by bplus - 01-02-2025, 05:45 AM
RE: which day of the week - by bplus - 01-02-2025, 05:55 AM
RE: which day of the week - by SMcNeill - 01-02-2025, 06:18 AM
RE: which day of the week - by eoredson - 01-02-2025, 06:32 AM
RE: which day of the week - by bplus - 01-02-2025, 06:42 AM
RE: which day of the week - by eoredson - 01-02-2025, 07:14 AM
RE: which day of the week - by bplus - 01-02-2025, 07:25 AM
RE: which day of the week - by bplus - 01-02-2025, 07:33 AM
RE: which day of the week - by eoredson - 01-02-2025, 07:49 AM
RE: which day of the week - by eoredson - 01-02-2025, 08:13 AM
RE: which day of the week - by bplus - 01-02-2025, 08:18 AM
RE: which day of the week - by eoredson - 01-02-2025, 08:22 AM
RE: which day of the week - by Pete - 01-02-2025, 08:34 AM
RE: which day of the week - by bplus - 01-02-2025, 08:34 AM
RE: which day of the week - by SMcNeill - 01-02-2025, 10:44 AM
RE: which day of the week - by SpriggsySpriggs - 01-02-2025, 02:14 PM
RE: which day of the week - by SierraKen - 01-02-2025, 05:58 PM
RE: which day of the week - by bplus - 01-02-2025, 10:14 PM
RE: which day of the week - by Pete - 01-02-2025, 06:57 PM
RE: which day of the week - by macalwen - 01-05-2025, 11:51 AM
RE: which day of the week - by Pete - 01-06-2025, 01:48 AM



Users browsing this thread: 20 Guest(s)