Call 1800-123-2003
how we get the week day if given date and year |
| We assume that we need to find the day of Aug 15, 1947 (India's Independence Day). Step 1: Find leap year or not. Using the above said conditions, find whether your year is leap year or not. To know whether a number is divisible by 4, you can see here * 1947 is not a leap year as it is not divisible by 4 Step 2: Find out total odd days on months. Method 1: Add all the days in the months before your month (that is august) and the date (that is 15) and find the remainder when the sum is divided by 7 * 31 + 28 (since, not a leap year) +31+30+31+30+31+ 15 = 227 * 227%7 = 3 Method 2: If adding like above is difficult, add all the odd days the months before august and add 15 % 7 = 1 to it. And then find the remainder when the sum is divided by 7. * 3 +0(since not leap year) +3+2+3+2+3+1 = 17 * 17%7 = 3 Consider 1601 - 1700 Every year we have one odd day (meaning 365 % 7 = 1) Every leap year have two odd day (meaning 366 % 7 = 2) In 100 years (say 1601 - 1700) we have 24 leap years, 76 normal years. That implies no of odd days in every 100 year = (2 x 24 + 1 x 76 ) % 7 = 124 % 7 = 5 so far 1601 - 1700 - 5 odd days for 1701-1800 - 5 odd days for 1801-1900 - 5 odd days for 1901-2000 - 5 + 1 odd days Since 2000 is a leap year where as 1700 and others are not, we have added 1 in the last statement. So far a set of 400, we have (5+5+5+6 )%7 = 21 % 7 = 0 odd days This implies, if 1-1-1601 is some day, then 1-1-2001 is also the same day, as the diff between them is 400. So we can reduce multiples of 400 from the year we have. that is 1947-1600= 347 Step 3: Find out the total odd days on year. Step 3(i): (only if greater than or equal to 100 in the above calculation) In 347 we have, 3 hundreds Therefore we have (no of odd days per hundred x no of hundreds) % 7 = (5 x 3) % 7 = 15 % 7 = 1 Now we can reduce multiple of 100 from the year we have. 347-300=47 Step 3 (ii) : Only if year greater than 1 in last calculation We have already found the odd days in the 1947th year in step 2 Excluding the 47th year, there are 11 leap years and 35 normal years from 1901-1946 so (11x2 + 35x1) % 7 = 57 % 7 = 1 Step 4: (step 2 + step 3(i) + step 3(ii)) % 7 (3 + 1 + 1 ) % 7 = 5 % 7 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 so 5 is Friday , which is the day of Aug 15th, 1947. |