Quicker Maths

Zeller’s Rule: Day on any date in the calendar

Posted on September 14, 2009

Zeller's Rule : With this technique named after its founder Zeller, you can solve any 'Dates and Calendars' problems.

Zellers rule can be used to find the day on any particular date in the calendar in the history. All you have to know is the formula given below and how to use it.

Zeller's Rule Formula:

F = K + [(13xM - 1)/5] + D + [D/4] + [C/4] - 2C

K = Date => for 25/3/2009, we take 25
In Zeller's rule months start from march.
M = Month no. => Starts from March.
March = 1, April = 2, May = 3
Nov. = 9, Dec = 10, Jan = 11
Feb. = 12
D = Last two digits of the year, using previous year for January and February. Thus for 2009 = 09
C = The first two digits of century => for 2009 = 20

Example: 25/03/2009

F = 25 + [{(13 x1)- 1}/5] + 09 + 09/4 + 20/4 - (2 x 20)
= 25 + 12/5 + 09 + 09/4 + 20/4  - 2x20
=25+2+09+2+5-40 [ We will just consider the integral value and ignore the value after decimal]
= 43 - 40 =

Replace the number with the day using the information given below.
1 = Monday
2 = Tuesday
3 = Wednesday
4 = Thursday
5 = Friday
6 = Saturday
7 or 0 = Sunday

So it's Wednesday on 25th march, 2009.

If the number is more than 7, divide the no. by 7. The remainder will give you the day.

I shall be very grateful if anyone of you can provide me the java script for this formula, so that I can post it here for everyone's convenience.

Thanks in advance. I hope you will find the above method very useful.

you may find another post named, cyclicity very interesting.

Vineet Patawari - PGDM, ACA, B.COM (H)

You may also like:

  1. Find Day of the Week on Any Date
  2. Rule of 72 – Estimation of Compound Interest and Time
  3. Which Day of the Week was My Birthday?

Posted by Vineet Patawari

Comments (30) Trackbacks (0)
  1. on 15/03/2013 then reminder is negative 2
    then what to do
    plz reply

    • -2 would be Friday. When 0 is Sunday, -2 would go back 2 days from there.

      Alternatively, you can add 7 to the result whenever the result is <0. So, in this case it -2+7 would be 5. Starting Monday as 1, 5 would be Friday.

      Hope this helps…

  2. hello!,I like your writing so a lot! share we be in contact extra about your post on AOL? I need a specialist on this house to resolve my problem. May be that is you! Looking ahead to peer you.

  3. Its not working for 16/01/1988. I am getting it Wednesday!!

    • Hi Rahul,

      I think you have used the function incorrectly,

      =TEXT(IF(J8+FLOOR((((13*J9)-1)/5),1)+J10+FLOOR((J10/4),1)+FLOOR((J11/4),1)-(2*J11)+1<0,J8+FLOOR((((13*J9)-1)/5),1)+J10+FLOOR((J10/4),1)+FLOOR((J11/4),1)-(2*J11)+8,J8+FLOOR((((13*J9)-1)/5),1)+J10+FLOOR((J10/4),1)+FLOOR((J11/4),1)-(2*J11)+1),"dddd")

      This works…

  4. This is very informative though some are difficult.

    thank you

  5. 31/08/1990 it is friday but i’m getting wrong answer………. once try..

  6. not workin for

    26 jan 1952

    itz saturday on tht day…..0 or 7 shud come..

    bt

    1is comin.
    ( REPLY )

  7. and if u have some time please visit http://www.splmaths.worpress.com

  8. Hey buddy i wrote the java code but oit is not working for the jan feb and march remaining all r fine i’m sending u the code lets c wat u can say abt the code and do reply me on raj.tvss@gmail.com or u can message me on 7204974366 i’m resedent of bangalore and here is the code

    CODE:

    import java.util.Scanner;
    import java.*;

    public class Date{
    public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    int d,c,day;

    //
    // Read year
    //
    System.out.print(“Year: “);
    int y = scanner.nextInt();

    // Read date
    System.out.print(“Date: “);
    int k = scanner.nextInt();

    //
    // Read month
    //
    System.out.print(“Month in numeric formate: “);
    int m = scanner.nextInt();

    switch (m)
    {
    case 1: m=11;
    break;
    case 2: m=12;
    break;
    case 3: m=1;
    break;
    case 4: m=2;
    break;
    case 5: m=3;
    break;
    case 6: m=4;
    break;
    case 7: m=5;
    break;
    case 8: m=6;
    break;
    case 9: m=7;
    break;
    case 10: m=8;
    break;
    case 11: m=9;
    break;
    case 12: m=10;
    break;
    }

    d=y%100;
    c=y/100;
    day = k*((13*(m-1))/5)+d+(d/4)+(c/4)-2*c;
    //System.out.println(“Day is”+day);

    if (day<0)
    {
    int day1 = -(day);
    int div = day1/7;
    int rem = 7*(div+1)+day;
    day=rem;
    }

    else

    {
    day=day%7;
    }

    switch (day)
    {
    case 0: System.out.print("The Given Date is a "+"Sunday");
    break;
    case 1: System.out.print("The Given Date is a "+"Monday");
    break;
    case 2: System.out.print("The Given Date is a "+"Tuesday");
    break;
    case 3: System.out.print("The Given Date is a "+"Wednesday");
    break;
    case 4: System.out.print("The Given Date is a "+"Thursday");
    break;
    case 5: System.out.print("The Given Date is a "+"Friday");
    break;
    case 6: System.out.print("The Given Date is a "+"Satday");
    break;

    }
    }

    }

  9. it just a logical works

  10. 18+{(13*12-1/5)}+91+91/4+19/4-38
    =18+35+91+22+4-38=132
    132/7 now remainder=6 implies thd day is saturday

  11. Dear Quicker Maths,

    How to Calculate the days of the week for a following date:

    1. 7th Dec, 1941
    2. 16th Apr, 2000
    3. 1st Jan, 2004
    4. 8th March, 2005
    5. 26th Jan, 1950
    etc

    how to calculate if the remainder is zero.

  12. sir its coming wrong for 18/2/1991 please give the corrected formula

  13. not workin for

    28/02/2010

    itz sunday on tht day…..0 or 7 shud come..

    bt

    1 is comin.

  14. In case of negative f, simply add a big multiple of 7 (say 70) to f and check for the remainder.
    For ex: f= -17
    -17 + 70 = 53
    Divide 53 by 7 to get remainder of 4.

  15. Dear, friends thanks for the great discussion and comments!

    @Bharat: Thanks for explaining the whole thing in your own words. From our side we tried to keep it as simple as possible. Thanks for including the explanation for negative ‘f’.

    Just to remove any error in your explanation I would like to point out this, “so -3 + 6 is again a remainder of 4.” which seems wrong. Please confirm.

    Thanks anyway for your contribution!

  16. its actually not explained proprrlyy hav a luk below 2 get the corrrect idea n mahesh ur query will also be solved …

    The following formula is named Zeller’s Rule after a Reverend Zeller. [x] means the greatest integer that is smaller than or equal to x. You can find this number by just dropping everything after the decimal point. For example, [3.79] is 3. Here’s the formula:

    f = k + [(13*m-1)/5] + D + [D/4] + [C/4] – 2*C.

    k is the day of the month. Let’s use January 29, 2064 as an example. For this date, k = 29.
    m is the month number. Months have to be counted specially for Zeller’s Rule: March is 1, April is 2, and so on to February, which is 12. (This makes the formula simpler, because on leap years February 29 is counted as the last day of the year.) Because of this rule, January and February are always counted as the 11th and 12th months of the previous year. In our example, m = 11.
    D is the last two digits of the year. Because in our example we are using January (see previous bullet) D = 63 even though we are using a date from 2064.
    C stands for century: it’s the first two digits of the year. In our case, C = 20.
    Now let’s substitute our example numbers into the formula.

    f = k + [(13*m-1)/5] + D + [D/4] + [C/4] – 2*C
    = 29 + [(13*11-1)/5] + 63 + [63/4] + [20/4] – 2*20
    = 29 + [28.4] + 63 + [15.75] + [5] – 40
    = 29 + 28 + 63 + 15 + 5 – 40
    = 100.

    Once we have found f, we divide it by 7 and take the remainder. Note that if the result for f is negative, care must be taken in calculating the proper remainder. Suppose f = -17. When we divide by 7, we have to follow the same rules as for the greatest integer function; namely we find the greatest multiple of 7 less than -17, so the remainder will be positive (or zero). -21 is the greatest multiple of 7 less than -17, so the remainder is 4 since -21 + 4 = -17. Alternatively, we can say that -7 goes into -17 twice, making -14 and leaving a remainder of -3, then add 6 since the remainder is negative, so -3 + 6 is again a remainder of 4.

    A remainder of 0 corresponds to Sunday, 1 means Monday, etc. For our example, 100 / 7 = 14, remainder 2, so January 29, 2064 will be a Tuesday.

  17. Sir,
    How to find the days by using Zeller’s Rule Formula for the year 2010 ,This Zeller’s Rule is applicable only for the year 2009,but the answer is not coming for the other years…

    plz send the correct solution to find the day for other years..

    Thank u for finding the answer for year 2009

  18. it will be really great if u help us in explaining the logic behind this formula…

  19. Very well organized formula ..
    especially, the leap year part, I Liked the most…

  20. informative but little difficult


Leave a comment

(required)

No trackbacks yet.