10th May 2025
← BackIn the past I’ve been interested in how to mentally calculate the weekday of any date (if you’re interested, more on this at the end!), but recently I was thinking about a similar — and more straightforward — problem: what will the day be in X days?
This may sound like a difficult problem — one that requires a pen and paper when dealing with more than a few days in the past or future — but once you know how, it’s a lot easier than you might think.
I’ve made a simple game, which I created with the help of ChatGPT. You can try it for yourself here:
https://weekdayoffset.davidhide.com/
Here’s an example question: If today is Monday, what day will it be in 426 days?
The way to calculate the answer is to use modular arithmetic, meaning how many times does 7 days (a week) wrap around 426? In other words, divide 426 by 7 and take the remainder. The answer in this case is that there’s a remainder of 6 days. Monday + 6 days = Sunday, so that’s our answer.
After practicing a bit, I’ve discovered a few techniques which make things easier.
It’s essential to be able to identify all the multiples of 7 up to 70 quickly.
You could improve your speed by learning up to 100 and beyond, but with diminishing returns.
As long as you know the multiples of 7 up to 70, you can use them to simplify even large numbers. For example, If today is Wednesday, what day will it be in 221 days?
You can round the number down to 220 and forget about the 0. The closest multiple of 7 into 22 is 21, so we can subtract 210 from 221 leaving us with 11, a much easier number to work with. We calculate that 11 leaves us a remainder of 4. Wednesday + 4 days is Sunday, so that’s our answer.
You should think of each day as a number:
0: Sunday 1: Monday 2: Tuesday 3: Wednesday 4: Thursday 5: Friday 6: Saturday
This way, if you know the answer is Saturday minus 4, you can just immediately think “6 – 4 = 2 which is Tuesday.”
If you need to subtract an amount that will result in a negative, e.g. Tuesday – 4 days, you can instead take 7 % 4 and add it, which is often easier.
7 % 4 = 3 Tuesday + 3 = Friday
The 7 % 4 step is extremely quick, so this feels simpler than trying to subtract directly.
It isn’t necessary to always find a multiple below the number. You can also use the remainder you’d have with the next multiple above the number and invert your final operation (add instead of subtract, and vice versa).
“If today is Wednesday, what day was it 347 days ago?”
You can use 350 as the nearest multiple of 7 (which is 3 over), so instead of subtracting 3 to find “days ago,” you add 3:
Wednesday + 3 = Saturday
This is easier than using 280 as a multiple, then working out 7 % 67.
If you remember that 100 % 7 = 2, you can use it as a shortcut for any number close to a hundred.
“If today is Sunday, what day will it be in 208 days?”
200 days: 2 * 2 = 4 4 + 8 = 12 12 % 7 = 5 Sunday + 5 = Friday
If you’re interested in calculating the weekday for any date, that too is easier than you might think. I use a mixture of mnemonics and simple mental arithmetic which is explained nicely by memory champion Nelson Dellis in this video.
I’ve made another game where you can practice that here: https://calculateweekday.davidhide.com
21st August 2021
If you're still serving images in long-time standard formats such as JPEG and PNG then a Google PageSpeed Insights analysis of your site will identify an opportunity to improve your page loading times by serving images in "next-gen" formats. There are several so-called "next-gen" image formats which offer superior compression to JPEG and PNG but in this post we will… Continue reading »
25th January 2021
What do WebSockets do? Hypertext Transfer Protocol (HTTP) is unidrectional, meaning requests can only be made by the client. This is a limitation which means that a certain class of web application cannot be built using HTTP alone. WebSockets are a separate communication protocol, fully compatible with HTTP, which allow for bidirectional communication between a client and a server. A protocol… Continue reading »