Know the Day of The Given Date Within Few Minutes


We can find the day of any given date by using some easy way by using a formula.

Day= (offset(century)+offset(year)+offset(month)+offset(date))%7

Now lets see how to find the offset value.

DATE

Offset(date)=date%7

That is, if the date is 30 then 30%7= 2(The reminder value when you divide 30/7)

0-Sunday

1-Monday

2-Tuesday

3-Wednesday

4-Thursday

5-Friday

6-Saturday.

Now lets move to month offset.

MONTH

Step 1: Find the number of days from January and find the number of days%7 For example in January 31%7=3

Step 2: Add the offset value of next month with the First step.

I hope you’ll understand clear with this table

Let Jan offset value be 0

Month Offset Number Of Days Days%7 Add With Next Month’s offset
 January  0  31  31%7=3  +3
 February  3(0+3)  28  28%7=0  +0
 March  3(3+0)  31  31%7=3  +3
April 6(3+3)  30  30%7=2  +2
 May 1((6+2)%7)  31  31%7=3  +3
 June  4(1+3)  30  30%7=2  +2
 July  6(4+2)  31  31%7=3  +3
 August  2((6+3)%7)  31  31%7=3  +3
 September  5(2+3)  30  30%7=2  +2
 October  0((5+2)%7)  31   31%7=3  +3
 November  3(0+3) 30   30%7=2  +2
 December  5(3+2)  31   31%7=3  +3

YEAR

FOR NON LEAP YEAR

Consider the last two digit of the year. For example if the year is 1990 just take 90 for calculation

Offset(year)=(Year+(Year/4))%7

Lets take 90 for example (90+90/4)%7

=(90+22)%7

=112%7 =0

Hence the year offset for 1990 is 0

FOR LEAP YEAR

Offset(year)=(Year+(Year/4)-1)%7 (Till 29th Feb)

If the Date is 26 feb 2004

Offset(year)=(4+(4/4)-1)%7

=(4+1-1)%7 = 4%7 =4

If the Date is March 1st 2004

Offset(year)=(4+(4/4))%7

=(4+1)%7 = 5%7 =5

Last but not the least is Century. Now lets see for century

CENTURY

The first two digit in the year is the century.

Take the multiple of 4 which is greater than the century taken. For example if its 18th century you’ve to take 20 which is multiple of 4 nearer to 18.

Offset(century)=((Multiple of 4 which is nearer to the century – 1)-century)*2

Let the century be 20

Offset(century)=((24-1)-20)*2

=(23-20)*2

=3*2=6

Now just add the offset value of century,year,month and date and take modulo of 7.

EXAMPLE

[box_light]Lets take an example date and see how it works.

For example consider the date 2-12-1989

Date offset is 2%7=2

Month offset of December is 5

Year offset of 89 is (89+(89/4))%7

=(89+22)%7 = 111%7 = 6

Century offset of 19 is ((20-1)-19)*2

=(19-19)*2=0

Day=(2+5+6+0)%7 =13%7 = 6

So The value of 6 is Saturday as i said before.

[/box_light]

Hope i have explained you clearly. If you find any difficulty kindly post your queries to us.

Tags: , , ,

You may also like

7 Comments

  • sudha
    August 10, 2012 at 12:55 PM

    check for 6-aug-2010
    not working

  • sudha
    August 10, 2012 at 1:00 PM

    sorry its working good

  • dolly
    December 17, 2012 at 11:38 AM

    Offset(century)=((Multiple of 4 which is nearer to the century – 1)-century)*2

    can you pls explain this?

  • anish
    April 16, 2013 at 10:19 PM

    What does 13%7 means? Does it means 13 divided by 7??

    • Kirthika
      May 12, 2013 at 9:40 AM

      13%7 is the reminder value of 13/7 ie) 13%7=6. Hope you understood.

  • Ezhil
    August 28, 2013 at 1:48 PM

    ya ya its working thank u!!!

  • cady
    October 24, 2014 at 2:43 PM

    check for 24-oct-2014

    whether it works?

LEAVE A COMMENT

Welcome To TechTwinklers!

Tech Twinklers is a Tech Blog run by Students with an aspiring enthusiasm in Technology and Gaming. This Blog will bring News about the Modern Technology, Educational Advances, Campus Interviews, etc. So make sure you subscribe to our blog because we don't want you to miss a thing that is posted here..

We're on Facebook!