Hacker News new | ask | show | jobs
How to calculate the weekday of any date in your head (downioads.github.io)
13 points by bed147373429 1081 days ago
2 comments

All it takes it to remember 12 single-digit numbers and reading through a blog post for 5 minutes! :)
What is the year code for 1947? For 1976?
Yeah this part is left out of the explanation
Hi, thanks for the feedback. If you know the code for year x, you can quickly calculate the code for year x-1 or x+1. If you want to be able to quickly do this for any given year you would have to know the code for every year by heart. I just updated my blog post: Now it contains the year codes from 1800 to 2039. It also contains a small Go script that generates all these year codes and all you need to do if you want more year codes is to adjust the for-loop interval.
Your own conclusion paragraph states that the code for 2024 is 1, but your pre-calculated table says different.
Thanks, fixed
Do you also have to account for leap years somehow? I think on leap years you need to add one to the month code for all months except Jan and Feb.
Hi, thanks for this question! On leap years the code for January and February is decreased by 1. Everything else stays the same! I updated the blog and the Go code to take care of this.