In Calendar, questions are mainly based on finding the day of the week if we are given a date. For example, we may be asked to find the day on 2 February, 1981.

- Finding day from date is based on calculating number of odd days. By odd days, we mean number of days more than complete number of weeks. For example,

Number of days in a non – leap year = 365

365 mod 7 = 1

So, number of odd days in a non – leap year = 1 - Number of days in a leap year = 366

=> Number of odd days in a leap year = 366 mod 7 = 2 - Number of odd days in 100 years (76 non – leap years + 24 leap years) = [(76 x 1) + (24 x 2)] mod 7 = (76 + 48) mod 7 = 124 mod 7 = 5 days
- Number of odd days in 200 years = (2 x Number of odd days in 100 years) mod 7 = 10 mod 7 = 3
- Number of odd days in 300 years = (3 x 5) mod 7 = 1
- Number of odd days in 400 years = (4 x 5 + 1) mod 7 = 21 mod 7 = 0

Note that here, we have added 1 day extra because 400th year would itself be a leap year. - To check if a non – centennial year is a leap year, we divide it by 4. If the remainder is 0, the year is a leap year. For example, 2016 mod 4 = 0. Thus, we can safely deduce that 2016 is a leap year.
- To check if a centennial year is a leap year, we divide it by 400. If the remainder is 0, the year is a leap year. For example, 1700 mod 400 = 100. So, it was not a leap year. But 1600 mod 400 = 0. Thus, we can safely deduce that 1600 was a leap year.
- Number of odd days = 0, Day = Sunday

Number of odd days = 1, Day = Monday

Number of odd days = 2, Day = Tuesday

Number of odd days = 3, Day = Wednesday

Number of odd days = 4, Day = Thursday

Number of odd days = 5, Day = Friday

Number of odd days = 6, Day = Saturday

### Sample Problems

**Question 1 : **What was the day on 14 April, 2000 ?

**Solution : **1600 will have 0 odd days.

300 years will have 1 odd day.

Now, in the next 99 years, we would be having 75 non – leap years and 24 leap years.

=> Number of odd days = (75 x 1) + (24 x 2) = 75 + 48 = 123 mod 7 = 4 odd days

Total odd days till now = 1 + 4 = 5

Number of odd days in January = 31 mod 7 = 3

Number of odd days in February (2000 is a leap year) = 29 mod 7 = 1

Number of odd days in March = 31 mod 7 = 3

Number of odd days till 14 April, 2000 in the month of April= 14 mod 7 = 0

So, total number of odd days = 5 + 3 + 1 + 3 = 12 mod 7 = 5

Thus, 14 April, 2000 was Friday (odd days = 5 => Friday)

**Question 2 : **What was the day on 16 August, 1947 ?

**Solution : **1600 will have 0 odd days.

300 years will have 1 odd day.

Now, in the next 46 years, we would be having 35 non – leap years and 11 leap years.

=> Number of odd days = (35 x 1) + (11 x 2) = 35 + 22 = 57 mod 7 = 1 odd days

Total odd days till now = 1 + 1 = 2

Number of odd days in January = 31 mod 7 = 3

Number of odd days in February (1947 is a non – leap leap year) = 28 mod 7 = 0

Number of odd days in March = 31 mod 7 = 3

Number of odd days in April = 30 mod 7 = 2

Number of odd days in May = 31 mod 7 = 3

Number of odd days in June = 30 mod 7 = 2

Number of odd days in July = 31 mod 7 = 3

Number of odd days till 16 August, 1947 = 16 mod 7 = 2

So, total number of odd days = 2 + 3 + 0 + 3 + 2 + 3 + 2 + 3 + 2 = 20 mod 7 = 6

Thus, 16 August, 1947 was Saturday (odd days = 6 => Saturday)

This article has been contributed by **Nishant Arora**

Please write comments if you have any doubts related to the topic discussed above, or if you are facing difficulty in any question or if you would like to discuss a question other than those mentioned above.

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above

Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the **DSA Self Paced Course** at a student-friendly price and become industry ready.

## Recommended Posts:

- Cisco Systems Interview Experience | On-Campus 2021
- Barclays Interview Experience | On-Campus ( Virtual ) September 2020
- Minimize splits to generate monotonous Substrings from given String
- Minimize Sum of an Array by at most K reductions
- Add and Remove Edge in Adjacency Matrix representation of a Graph
- Check if two nodes are on same path in a tree | Set 2
- Minimum count of numbers required with unit digit X that sums up to N
- Print the longest path from root to leaf in a Binary tree
- Largest number M less than N such that XOR of M and N is even
- Shortest path in a complement graph
- First element of every K sets having consecutive elements with exactly K prime factors less than N
- Puzzle | Single Elimination Tournament
- Minimum changes required to make all Array elements Prime
- Puzzle | The Circle of Lights