How to Count the Number of Days Between Two Dates
In practice, it is easy to estimate the number of days between two dates if you assume that a year has 365 days and a month has 30 days. However, if you need to calculate the number of days with precision, you must account for leap years and the fact that not every month has 30 days.
The most common method for counting the number of days between dates is based on the idea of Julian Day Numbers. The JDN of a particular date is the number of days that have elapsed between the date and a fixed point in time in the past. When you calculate the Julian Day numbers of two dates, you can subtract them to obtain the number of days between those dates.
The steps below describe how to compute Julian Day Numbers, or you can use the convenient calculator on the left to quickly determine the number of days between two dates.
Step 1To compute the Julian Day Number for a date, call its year number of each Y and its day of the month D. For the month number M, use March = 0, April = 1, ..., January = 10, and February = 11. This method of assigning numbers to the months places February at the end of the annual cycle. Making February the last month simplifies the JDN formula since February has a variable number of days. Also, when the date occurs in January or February, you must subtract 1 from the year.
(When entering dates in the calculator, do not worry about subtracting 1 from the year. The calculator takes care of these adjustments for you. For example, if you want to find the number of days between February 1, 1999 and June 1, 2009, enter 1999 and 2009 as the years, not 1998 and 2009.)
Step 2Compute the following sum for each date:
D + ⌊(153M+2)/5⌋ + 365Y + ⌊Y/4⌋ - ⌊Y/100⌋ + ⌊Y/400⌋
For example, if you choose the dates February 1, 1999 and June 1, 2009, then you compute
1 + ⌊(153(11)+2)/5⌋ + 365(1998) + ⌊1998/4⌋ - ⌊1998/100⌋ + ⌊1998/400⌋ = 730092, and
1 + ⌊(153(3)+2)/5⌋ + 365(2009) + ⌊2009/4⌋ - ⌊2009/100⌋ + ⌊2009/400⌋ = 733865
Step 3Subtract the two numbers you computed in Step 2. This is the total number of days between the two dates. Since 733865 - 730092 = 3773, there are 3,773 days between February 1, 1999 and June 1, 2009.
© Had2Know 2010