In part-1 we learnt hoe to find day for a given date in the 21st century i.e. from year 2000 to 2099. here we will see how to find for other centuries.
As we mostly deal with the current century and previous century one simple formula is find the day for current century and add 1 to it for 1900s. This mean we can first find the day for 20th July 2053 and then add one to final result. As 20th July 2053 is Sunday and hence 20th July 1953 was Monday.But let us understand the full logic.
For this the only change is adjustment for the year code. For year 1900 to 1999 we need to add 1 to year code so for 1915 the year code is 4+1=5 and for 1914 it is 3+1=4.
So for finding day for 20th July 1953 steps are
Year code for 2053 is 53+13=66/7 and remainder is 3 and hence for 1953 year code is 4
Month code for July is 5
Now date value is 4+5+20=29 and dividing by 7 we get remainder as 1 and the day is Monday
For any date in other centuries we need to do adjust the year code as follows :
As we mostly deal with the current century and previous century one simple formula is find the day for current century and add 1 to it for 1900s. This mean we can first find the day for 20th July 2053 and then add one to final result. As 20th July 2053 is Sunday and hence 20th July 1953 was Monday.But let us understand the full logic.
For this the only change is adjustment for the year code. For year 1900 to 1999 we need to add 1 to year code so for 1915 the year code is 4+1=5 and for 1914 it is 3+1=4.
So for finding day for 20th July 1953 steps are
Year code for 2053 is 53+13=66/7 and remainder is 3 and hence for 1953 year code is 4
Month code for July is 5
Now date value is 4+5+20=29 and dividing by 7 we get remainder as 1 and the day is Monday
For any date in other centuries we need to do adjust the year code as follows :
- 2300 to 2399 = add 1
- 2200 to 2299 = add 3
- 2100 to 2199 = add 5
- 2000 to 2099 = add 0
- 1900 to 1999 = add 1
- 1800 to 1899 = add 3
- 1700 to 1799 = add 5
- 1600 to 1699 = add 0