day_of_week

Given a date, determine the day of the week it falls on. All based on last day of February in the year, the doomsday. Several places have info from which I've put this together for the Lexington Computer Group; see Wikipedia's entry.

calendars for demo

Weds | Tues | Sun | Fri |

1900 | 2000 | 2100 | 2200 |

1500 | 1600 | 1700 | 1800 |

- 1700: Sun shined on USA SUNDAY
- 1800: Ate = Fries = FRIDAY
- 1900: We'd this century WEDNESDAY
- 2000: Tue-thousand TUESDAY

This is the odd-plus-eleven method.

- Determine anchor day of Century.
- Now work with the last 2 digits of year.
- Is year odd? If so add 11
- Divide by 2
- Is result odd? If so add 11
- Divide by 2
- Take mod 7
- Subtract this from 7; add resulting number of days to anchor day for the year's doomsday

Now compute day given month.

Jan | Jan 3 unless it's leap year then Jan 4 |

Feb | Feb 7 unless it's leap year then Feb 8 |

Mar | Mar 7 |

apr, june, august, october, december | month number (October is 10th month so Oct 10) |

9-to-5 and 7-11 | Sept 5, May 9th, July 11, Nov 7 |

Signing declaration of independence, July 4, 1776.

1700: anchor is Sunday

76 is even, /2 is 38, is even, mod 7 is 3, from 7 is 4, Sunday + 4 is Thursday is doomsday for 1776.

July 4, 7th month 11th day, hence 4th day, falls on Thursday.

Day of moon landing, July 20, 1969

1900: anchor is Wednesday

69 is odd +11 is 80 /2 is 40 is even, mod 7 is 5, from 7 is 2, so doomsday for 1969 is Friday

July 11 and 18 are doomsday, Friday, so July 20 is Sunday.

Signing WW1 armistice, Nov 11, 1918.

1900: anchor is Wednesday

18 is even, /2 is 9, 9 is odd +11 is 20. Mod 7 is 6, from 7 is 1, so doomsday for 1918 is Thursday

Nov 7 is Thursday, so 11th is Monday.

page stats

page stats

This page has been visited 5 times today, 2 times yesterday, and 3956 total times since 12/29/2020.

day_of_week.txt · Last modified: 2021.12.22 13:51 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International