 Year end is about holidays and New Year wishes. But it is also about Calendars. I don’t know about others but I like to “read” new calendar, immediately check few dates or events, festivals!

I remember having written a couple of blog posts about Calendar. One, written in 2007, was a light take on Calendar – Calendar विषयी थोडेसे… (It’s in Marathi)

The other was written in 2010 about the mathematics behind the Calendar, or how to calculate day of any date. I was not able to find it in Archive – probably it got lost when I imported my old blog into this domain. So posting it here again. It was written on 13th February 2010:

Few years ago I was learning a programming language and was given an assignment to display calendar and tell day of date .

Instead of using library function I wrote the logic to come up with the day of that date. I had worked it out long back when I was in school – when I had read about Shakuntala Devi. I was fascinated by how to do mathematical calculation in head so quickly, or tell day of any past or future date. For mathematical calculations I read some books on Vedic Maths and learnt few things. As for date, I worked it out purely on my own. Don’t know if that is how those people do it or is there some other/better way. But this method works fine. And its very easy to do, once you understand how calendar works.
Let me explain how.
1. There are 365 days in a normal year and 366 in a Leap year.
2. If the year is divisible by 4 (but not by 100) then the year is a Leap year e.g. 1988, 1876, 2024 etc.
3. If the year is divisible by 100 and also by 400 then the year is a Leap year. e.g. 2000, 1600, 2400.
4. If the year is divisible by 100 but not by 400, then the year is NOT a Leap year. e.g. 1800, 1900, 1700, 2100 etc.
Now with these basics we can go ahead to discuss the logic:
Let’s understand the concept of ‘odd day’.
The weekdays are Sunday through Saturday. And then the cycle repeats continuously. So if there are exactly 4 weeks then thee is no ‘odd day’ i.e. extra day. In a 30-day month there are 4 complete weeks and 2 ‘odd days’ (i.e. extra days). In a 31-day month, there are In a leap month (February of a Leap year) there is one odd day.
So lets first see how many odd days are there in each month. (All you have to do is take modulus of 7 for each month…)
• January – 3
• February – 0
• February in a Leap year – 1
• March – 3
• April – 2
• May – 3
• June – 2
• July – 3
• August – 3
• September – 2
• October – 3
• November – 2
• December – 3
In a normal year there are 365 days i.e. 52 weeks and 1 odd day. In case of a Leap year there are 2 odd days.
So now we are good to find day of any date. But before that, to make life easy we need a a reference day (it’s not mandatory but beneficial).
1st January 1900 was Monday
1st January 2000 was Saturday
Note: For any day in 20th and 21st century these 2 reference days respectively are enough)
——————————————————————
Lets work out some examples:
Example 1. 15th Aug 1947 (India’s Independence Day)
Reference Date: 1st January 1900 was Monday i.e. Day ZERO
Step 1: 46 completed years since 1900. i.e. 46 odd days (1 odd day per year, not counting leap years). This is further equivalent to 7 weeks and 4 odd days
Step 2: There were 11 Leap years between 1900 and 1946 (i.e. 1946-1900 MOD 7). So 11 more odd days. i.e 1 week and 4 odd days
Step 3: Odd days for Year 1947 (till July 1947) are 16 (3+0+3+2+3+2+3) i.e. 2 weeks and 2 odd days
Step 4: As on Aug 15, there was 1 odd day

Adding odd day for Steps 1 through 4 we get 4+4+2+1 = 11 odd days i.e. further equal to 4 odd days.

Since reference day 1st January 1900 was Monday, counting 4 days from that day we get Friday.
So 15th August 1947 was Friday!
————————————————————————————————
Example 2. 11th September 2001 (World Trade Center Attack)
Reference: 1st January 2000 was Saturday
Step 1: 0 completed year since 2000. So 0 odd days
Step 2: 1 Leap year since 2000. So 1 odd days
Step 3: Odd days till August 2001 (3+0+3+2+3+2+3+3) are 19 i.e. 2 weeks and 5 odd days
Step 4: As on September 11, there were 4 odd days
Adding odd day for Steps 1 through 4 we get 0+1+5+4 = 10 i.e. 3 odd days.
Since reference day 1st January 2000 was Saturday, counting 3 days from that day we get Tuesday.
So 11th September 2001 was Tuesday!
————————————————————————————————
Example 3. 26th November 2008 (Mumbai Attack)
Reference: 1st January 2000 was Saturday
Step 1: 7 completed years since 2000. i.e. 7 days. So 0 odd days
Step 2: 2 Leap years since 2000. So 2 odd days
Step 3: Odd days till October 2001 (3+1+3+2+3+2+3+3+2+3) are 25 i.e. 3 weeks and 4 odd days
Step 4: As on November 26, there were 5 odd days
Adding odd day for Steps 1 through 4 we get 0+2+4+5 = 11 i.e. 4 odd days.
Since reference day 1st January 2000 was Saturday, counting 4 days from that day we get Wednesday.
So 11th September 2001 was Wednesday!
————————————————————————————————
Example 4: 25th June 1983 (India’s World Cup Cricket Win)
Reference Date: 1st January 1900 was Monday i.e. Day ZERO
Step 1: 82 completed years since 1900. i.e. 82 odd days –> 5 odd days
Step 2: There were 20 Leap years between 1900 and 1982. So 20 more odd days. i.e 2 week and 6 odd days
Step 3: Odd days for Year 1983 (till May 1983) are 11 (3+0+3+2+3) i.e. 4 odd days
Step 4: As on June 25, there were 4 odd days

Adding odd day for Steps 1 through 4 we get 5+6+4+4 = 19 odd days i.e. further equal to 5 odd days.

Since reference day 1st January 1900 was Monday, counting 5 days from that day we get Saturday.
So 15th August 1947 was Saturday!
————————————————————————————————
Example 5: Today i.e. 13th February 2010
Reference: 1st January 2000 was Saturday
Step 1: 10 completed years since 2000. i.e. 10 days. So 3 odd days
Step 2: 3 Leap years since 2000. So 3 odd days
Step 3: Odd days till January 2010 are 3 i.e. 3 odd days
Step 4: As on February 13, there were 6 odd days
Adding odd day for Steps 1 through 4 we get 3+3+3+6 = 15 i.e. 1 odd day.
Since reference day 1st January 2000 was Saturday, counting 1 day from that day we get Sunday.
Yes, today is Sunday! 🙂

​​

Let’s update this for today’s date i.e. 27th December 2017.

Reference: 1st January 2000 was Saturday
Step 1: 16 completed years since 2000. i.e. 16 days. So 2 odd days
Step 2: 5 Leap years since 2000. So 5 odd days
Step 3: Odd days till end of November 2017 are 26 i.e. 5 odd days (26 mod 7)
Step 4: As on December 27, there were 6 odd days (27 mod 7)
Adding odd day for Steps 1 through 4 we get 2+5+5+6 = 18 i.e. 4 odd days.
Since reference day 1st January 2000 was Saturday, counting 0th day from that day we get Wednesday.
Yes, today is Wednesday! 🙂

​​

The reason I remembered this blog post was this very interesting video: A Tale of Two Calendars
I will write about this in subsequent blog. Meanwhile, do watch this video. Also do some exercises about finding the day given a date…hope you find it entertaining and useful!