1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Number of days between two dates

  1. Nov 6, 2013 #1
    1. The problem statement, all variables and given/known data
    Find the number of days between (December 8, 1980) and (November 6, 2013).

    2. Relevant equations
    3. The attempt at a solution

    There are 33 years between these two dates (if I get (December 8, 1980) and (December 8, 2013)).

    The number of leap years is int(33 / 4) = 8. Hence, I got:

    Number of days = (8*366) + (25*365) - (days between November 6, 2013 to December 8, 2013)

    days between 12/08/2013 to 06/11/2013 = 24 + 8 = 32

    So,

    Number of days = (8*366) + (25*365) - 32
    Number of days = 2928 + 9125 - 32 = 12021

    Well, I checked online ( http://www.timeanddate.com/date/duration.html ) and the right answer is 12.021

    EDIT: I got to the answer. Just to check: is that the right way of checking leap years? number of years divided by four?
     
    Last edited: Nov 6, 2013
  2. jcsd
  3. Nov 6, 2013 #2

    UltrafastPED

    User Avatar
    Science Advisor
    Gold Member

    Count the years - 1981 through 2012 is 32 years. 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012 are all leap years; so you have 8 extra days. There are 23 days left over in 1980, and 31+28+31+30+31+10= 161 days in 2013.

    32*365 + 8 + 23 + 161 = 11,872 days.

    The date calculator includes the initial date, but the OP says "between", so it has one day extra.

    So between 12/08/1980 to 06/11/2013 there are 11,872 days.

    Your "correct answer" has an extra 149 days ... that's about five months, taking you from June to November.
    So check that your dates are correct!
     
  4. Nov 6, 2013 #3

    Mark44

    Staff: Mentor

    Is 12/08/1980 a date in December or August? In the US we typically write dates in the form MM/DD/YYYY, but in Europe and elsewhere, they usually write them as DD/MM/YYYY.
     
  5. Nov 6, 2013 #4

    UltrafastPED

    User Avatar
    Science Advisor
    Gold Member

    Good point! I only remember that when I'm in Germany. :-)
     
  6. Nov 6, 2013 #5
    Oh, I'm sorry, I forgot to use your standard date format.

    I edited the original post.
     
    Last edited: Nov 6, 2013
  7. Nov 6, 2013 #6

    UltrafastPED

    User Avatar
    Science Advisor
    Gold Member

    No ... under the current system the year is a leap year if it is divisible by 4, excluding those which are divisible by 100, but including those which are divisible by 400.

    So 2000 was a leap year, but 1900 and 2100 are not ...
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted