CALENDAR PROBLEMS
For solving the calendar problems we may need the following info.
We can find the number day on which a particular date falls by finding the number of odd days.Odd days are obtained by finding the remainder when the no of days are divided by 7The no of days in each month in a year is Jan-31, Feb-28(29), Mar-31, Apr-30, May-31, Jun-30, Jul-31, Aug-31, Sep-30, Oct-31, Nov-30, Dec-31No of odd days in each month in a year -Jan-3, Feb-0(1), Mar-3, Apr-2, May-3, Jun-2, Jul-3, Aug-3, Sep-2, Oct-3, Nov-2, Dec-3Leap year: A year is said to be Leap year if it contains366 days (ie,29 days in February)
How to find whether a year is leap year or not ?
1) We get a leap year if that year is divisible by 4 exactly
2) Years divisible by 100 and not by 400 is not a leap year1st January 0001 was a Monday. Calendar repeats after every 400 years. Calendar moves ahead by number of odd days. In a normal year 1st January and 2nd July and 1st October fall on the same day.In a leap year 1st January 1st July and 30th September fall on the same day.Ordinary year = 52 weeks + 1 odd dayLeap year = 52 weeks + 2 odd day 100 Years = 76 ordinary years +24 leap years
100 years has 5 odd days
400 years has (20+1) odd days ie , 0 odd days.Here are the steps to find out the number of odd days.
Step 1: Find leap year or not.
Step 2: Find out total odd days on months.
Step 3: Find out the total odd days on year.
Step 4: Finally add the total number of odd days between the given dates.Jan 1, 2001 is a Monday, depending on odd day, we have
1 is Monday
2 is Tuesday
3 is Wednesday
4 is Thursday
5 is Friday
6 is Saturday
0 or 7 is Sunday