Calculating Day Of Week


Today we will see how to perform weekday and other calendar related calculation.
Let's say today is the $1\raise{3px}{st}\ of\ January$ of some year and is a $Wednesday$. Can you tell what which day of the week will be $17\raise{3px}{th}\ of\ February$ without looking at calendar?
Let's see how can we do this.
If today is a $Wednesday$, then the $7\raise{0.3em}{\underline{th}}$ days from now, not including today, will be a $Wednesday$ as well, and the date after $7$ days will be the $8\raise{3px}{th}$.
Similarly $14$ days from now, $21$ days from now, or any multiple of $7$ will also be $Wednesdays$.
So to find the day of the week for $17\raise{3px}{th}\ of\ February$ we need to find the number of days till that date, and find the remainder when we divide that number by $7$.
Let us calculate the number of days from now till $17\raise{3px}{th}\ of\ February$. Remember that we should not count the starting day but we should count the last day.
$January$ has $31$ days, so, from $1\raise{3px}{st}\ of\ January$ to $31\raise{3px}{st}\ of\ January$ is $31 - 1 = 30$ days, and then another $17$ days in $February$. Therefore there are a total of $30 + 17 = 47$ days from now till $Feb\ 17$.
When we divide $47$ by $7$ we get a remainder of $5$ $(47 \div 7 = quotient\ 6\ and\ remainder\ 5)$.
We know that if we got a remainder of $0$ then it would be same as the starting day, that is, $Wednesday$. Since we have a remainder of $5$ days we need to add $5$ days to $Wednesday$ so we get a $Monday$.
Therefore, $17\raise{3px}{th}\ of\ February$ will be a $Monday$.

Now we will see how to find the day on a date before the start date.
Let us say the start date is $10\raise{3px}{th}\ of\ August$ in a particular year and is a $Sunday$. What was the day on $3\raise{3px}{rd}\ March$ of the same year?

-----------book page break-----------
Again we calculate the number of days between $March\ 3$ and $August\ 10$, not including the start date.
$10$ days in $Aug$. We need to include the last day.
$31$ days in $July$
$30$ days in $June$
$31$ days in $May$
$30$ days in $April$
$31 - 3 = 28$ days in $March$. Remember we should not include the first day.
Adding all the days, we get $10 + 31 + 30 + 31 + 30 + 28 = 160$ days. When we divide $160$ by $7$ we get a remainder of $6$.
Since we are calculating a previous date, instead of adding $6$ to $Sunday$ we need to subtract $6$ from $Sunday$ which will give the same result as adding $7 - 6 = 1$ day to a Sunday. Therefore, $3\raise{3px}{rd}\ March$ of the same year was a $Monday$.