Results 1 to 2 of 2

Math Help - Calculating Gregorian Day

  1. #1
    Newbie
    Joined
    Jul 2008
    Posts
    7

    Calculating Gregorian Day

    I am trying to follow this algorithm, but I'm going wrong somewhere and can't seem to figure it out:
    Day of Week -- A program for converting Gregorian dates in the form month-day-year to day of the
    week is the following. Let the Gregorian date be represented by M/D/Y where we have the following
    de finitions:

     M is the month of the year. Let m be the month number derived from M by the rule m is M-2
    if M>=3 and m is M + 10 otherwise.
     d is the day of the month.
     y is the year of the century.
     c is the number of the previous century.
    The algorithm is as follows:
    (a) A is the integer part of (13m - 1)/5.
    (b) B is the integer part of y/4.
    (c) C is the integer part of c/4.
    (d) D = A + B + C + d + y - 2c.
    (e) Make R equal to the remainder of D/7.
    (f) Interpret R as Sunday if R = 0, Monday if R is 1, etc.
    So take today's date as an example, 8th May 2012 (Tuesday) or 8/5/2012

    The month is greater than 3, so m = (5 - 2) = 3
    d = 8
    y = 2012
    c = 20
    A = ((13 * 3) - 1) / 5 = 7.6, however above it says the integer part, so A = 7
    B = 2012 / 4 = 503
    C = 20 / 4 = 5
    D = 7 + 503 + 5 + 8 + 2012 - (2 * 20)
    D = 2495
    R = 2495 % 7 = 3

    So we would interpret today's date as a Wednesday? I must be doing something wrong here, can anyone spot what it is?

    Thank You
    -Sam
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member Sylvia104's Avatar
    Joined
    Mar 2012
    From
    London, UK
    Posts
    107
    Thanks
    37

    Re: Calculating Gregorian day

    I just used the algorithm to compute the day of the week of my date of birth, which I know was a Sunday; however the algorithm turned up Tuesday instead. Maybe the algorithm needs tweaking.
    Last edited by Sylvia104; May 8th 2012 at 06:33 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Calculating 10^30-90
    Posted in the Algebra Forum
    Replies: 4
    Last Post: March 2nd 2010, 12:18 PM
  2. Another calculating y'
    Posted in the Calculus Forum
    Replies: 7
    Last Post: January 3rd 2010, 02:05 PM
  3. Calculating y'
    Posted in the Calculus Forum
    Replies: 5
    Last Post: January 3rd 2010, 12:34 PM
  4. help calculating p-value (again)
    Posted in the Advanced Statistics Forum
    Replies: 2
    Last Post: July 23rd 2008, 07:01 PM
  5. calculating p-value
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: July 20th 2008, 08:06 PM

Search Tags


/mathhelpforum @mathhelpforum