How to get day of week from a date ?

Below is the kind of diagram I used 20 years ago : here, I have taken year 2012 calendar for getting the 1st day of each month. For this leap year,

– the 1st( January), 4th (April) and Seventh (July) month start with Sunday.

– The 3rd, 6th and 9th month are on the left and,

– the 2nd, 5th and 8th month on the right.

Funny thing here is that Marko Rodin said that (1,4, 7) are in another plan compared to (2,5, 8) and … (3, 6, 9) is still another plan. For example (1, 4, 7) = (O, x, y); (2, 5, 8) = (O, y, z) and (3, 6, 9) = (O, z, x)

calendar2012

 

 

Calendar-template-2012-7

 

After getting that diagram by heart, you must master the sequence : 1,8, 15, 22, 29 … as you can see the month of January above, it has all its sundays on 1, 8, 15, 22 and 29. How to get these numbers by heart ? Easy. You just have to add seven each time i.e :

1 + 7 = 8;

8 + 7 = 15;

15 + 7 = 22;

22 + 7 = 29

 

After mastering both of them, you’ll be able to calculate by mind any day of the year 2012.

1st  example, let us take 19th july 2012.

–  knowing that July = 7. You are on the axis of the 1st figure above … 1, 4, 7 are Sundays.

– You know the sequence numbers 1, 8, 15, 22 and 29. Here 19 is close to 22.

– As 22 is also Sunday because for the months 1, 4, and 7, the first day is Sunday, so the 8th, 15th and 22th day are also sundays … To get the weekday of 19, you do “Sunday – 3” … – 1 = Saturday; – 2 = Friday and – 3 = thursday.

So the answer is : Thursday. Just knowing by  heart the 1st figure and the sequence 1, 8, 15, 22, 29 … you are able to figure out the day of week.

2nd example : 29th december 2012

– Knowing that the left part of the figure is (3, 6, 9) where 12 is under 9 … and knowing that the 1st day of the year is Sunday, you deduce that the 12th month starts with “Sunday – 1” = Saturday.

– Knowing that 1st december 2012 is Saturday, it’s very easy to deduce the 29th day of that month because 1 = 8 = 15 = 22 = 29 … all these days are saturdays, so 29th December 2012 is also a Saturday !

 3rd Example : this technic is valid for all leap years. Let’s calculate the same days in the 2016 calendar

The calendar starts with Friday

(another trick to remember : if 1st January of 2012 is Sunday, then 1/1/2016 is Friday … Sunday – 2 and 1/1/2008 = Sunday + 2 = Tuesday).

19th July 2016 => The 1st day is also Friday, so 19th is 22nd – 3 = Friday – 3 = Tuesday.

For 29th December 2016 => 1st day is Friday – 1 = tuesday, so 29th Dec 2016 is also Tuesday.

Note that you can go from 1 leap year to another easily. As per 2016 which starts with Friday because 2012 starts with Sunday … You can deduce the 1st day of 2008, 2004, 2000 … But also 2020, 2024 and so on.

4th example : what about non-leap years ? For example 2015 or 2013 …

If you have 2 calendars like 2015 and 2016 or even 2013 … Just see and deduce how the day of the week can be calculated. First of all, you need to master completly the calculus for a leap year such as 2016. Get the 1st figure above on which you find (1, 4, 7) axis and (2, 5, 8) on the right as well as (3, 6, 9) on the left .. BY HEART. Then, the sequence 1, 8, 15, 22 and 29. With both of them ask yourself “what is the weekday of DD/ MM/ YYYY ? and verify the answer on http://www.timeanddate.com/date/weekday.html

After mastering leap year technic, i.e, when you are able to calculate the weekday as fast as rainman 😉 … then, face the non-leap years. The intuitive technic here is to add one day if the year falls one year after the leap year (like 2013) or substract 1 day if the year falls one year back (2011). Why does it work ? Because we add the 29th day for February of the leap year, so all days coming after 28 February are easy to get.

For example, let’s take 19th July 2013. From the 1st example, you know that 19th July 2012 is Thursday. So, 19th July 2013 is Thursday + 1 … It looks easy. 19 july 2014 is Thursday+ 2. 19 july 2015 is Thursday+3 … But, this way of deducing the weekday doesn’t work if the date falls before 28 February.

Go to http://www.timeanddate.com/date/weekday.html   and type a date like 1st January 2013. You may think that it falls a Monday ’cause 1st January 2012 is Sunday … But it falls a Tuesday ! Why ? Because we have that 29th February added to the leap year 2012 so, for all days coming before 1st March, you must add +2 (+1 because you are going to the next year and you “leap” another one because that leap day, 29th February is added in 2012) … And for all days beginning with 1st March, adding 1 is enough. Verify on  http://www.timeanddate.com/date/weekday.html

So, after mastering the leap year technique with the triplets (1, 4, 7); (2, 5, 8) and (3, 6, 9), you’ll take time to master non-leap years. What’s the next step ? Well, calculating any day of any year from year 0 to year 2016 ! The technic here is having another sequence (multiples of 12) and multiples of 400.

.Well, you can deduce 1/1/2000, … 1/1/2024,   1/1/2036  etc knowing that  1/1/2012 = Sunday ..

1/1/2000 = Saturday ( -1 )

1/1/2012 = Sunday

1/1/2024 = Monday  ( + 1)

1/1/2036 = Tuesday ( + 2)

Every 12 years, you add one day to get the 1st January of that year. Play with all this a bit, if you want to showcase your rainman ability and impress your friends. It may look difficult at first sight but with practice you can go faster and faster. But beware, you may be labeled as rainman 🙂

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s