Number of days between two dates

  • Thread starter Thread starter frank1
  • Start date Start date
AI Thread Summary
The discussion revolves around calculating the number of days between December 8, 1980, and November 6, 2013. The initial calculation incorrectly included extra days and miscounted leap years, leading to an incorrect total of 12,021 days. After further analysis, the correct method considers 32 years, 8 leap years, and the specific days in 1980 and 2013, resulting in a total of 11,872 days. The importance of date format clarity is highlighted, as the date could be interpreted differently in various regions. The correct leap year calculation excludes years divisible by 100 unless they are also divisible by 400.
frank1
Messages
25
Reaction score
0

Homework Statement


Find the number of days between (December 8, 1980) and (November 6, 2013).

Homework Equations


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:
Physics news on Phys.org
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!
 
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.
 
Mark44 said:
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.

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

I edited the original post.
 
Last edited:
frank1 said:
Just to check: is that the right way of checking leap years? number of years divided by four?

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 ...
 

Similar threads

Replies
7
Views
7K
Replies
5
Views
2K
2
Replies
93
Views
14K
Replies
7
Views
2K
2
Replies
67
Views
14K
Replies
4
Views
4K
Back
Top