# Days Calculator

 Start Date End Date Include end day Count All days Weekdays only Weekends only Custom

This days calculator counts the number of days between two dates. It can also count weekdays or weekends only, or specifically selected days. To use the calculator, please provide two dates and click the "Calculate" button. If the end date is earlier than the start date, the calculator will swap the positions of the entered dates.

## How to calculate days between two dates

There are a number of ways to calculate the number of days between two dates. The method described below is the method used by this calculator.

There are two key factors that we need to consider when calculating the number of days between two dates: leap years and the differing number of months between two dates.

### Leap years:

A leap year is a calendar year that contains 1 additional day; a regular calendar year has 365 days while a leap year has 366 days. The extra day occurs in the month of February. In a regular calendar year, there are 28 days in the month of February. In a leap year, there are 29 days. To determine whether a given year is a leap year, use the following algorithm:

1. Divide the year by 4. If the year is not evenly divisible by 4, the year is not a leap year. If the year is evenly divisible by 4, continue to step 2.
2. Divide the year by 100. If the year is not evenly divisible by 100, it is a leap year. If the year is evenly divisible by 100, continue to step 3.
3. Divide the year by 400. If the year is not evenly divisible by 400, it is not a leap year. If it is evenly divisible by 400, it is a leap year.

For example, consider the year 2000:

1. 2000 ÷ 4 = 500. Since 2000 is evenly divisible by 4, continue to step 2.
2. 2000 ÷ 100 = 20. Since 2000 is evenly divisible by 100, continue to step 3.
3. 2000 ÷ 400 = 5. Since 2000 is evenly divisible by 400, it is a leap year.

As another example, consider the year 1000:

1. 1000 ÷ 4 = 250. Since 1000 is evenly divisible by 4, continue to step 2.
2. 1000 ÷ 100 = 10. Since 1000 is evenly divisible by 100, continue to step 3.
3. 1000 ÷ 400 = 2.5. Since 1000 is not evenly divisible by 400, it is not a leap year.

When determining the number of days between two dates, it is necessary to determine which years in the range of dates is a leap year. Otherwise, the calculation will be inaccurate (fewer days will be counted than the correct number) if the two dates span any leap years.

### Variation in months:

There are different ways to consider the number of days in a month. This calculator's definition is based on the length of each month from the starting month, as opposed to being based on a set number of days. For example, this calculator considers February 28th to March 28th to be one month because there are 28 days in February (in a regular calendar year), and March 28th is 28 days later. Similarly, March 28th to April 28th is also considered to be one month, since there are 31 days in March, and April 28th is 31 days later. Thus, based on this definition, February 28th to March 31st spans a duration of 1 month and 3 days.

In other definitions of a month, February 28th to March 31st may be considered to be a period of 1 month, since February 28th is the end of the month of February, and March 31st is the end of the month of March. Similarly, one could consider the duration between January 1st and February 1st to be one month, since they are both the first day of their respective months. However, this is not the definition of a month that is used by this calculator. It is important to understand the former definition described above. Otherwise, confusion may arise when examining the results of the calculator.

### Calculation:

Taking leap years and the definition of months described above into consideration, we can now calculate the number of days between two dates. Consider the dates 10/22/1983 and 01/15/2020.

2020 - 1983 = 37

Thus, there are 37 years between 10/22/1983 and 01/15/2020. To simplify the calculation of the number of days, we can break the calculation up into two periods: 10/22/1983 - 10/22/2019 and 10/22/2019 - 01/15/2020. The first range of dates allows us to determine exactly how many years have elapse and the second range of dates is the remaining number of months and days.

There are 36 full years between 10/22/1983 and 10/22/2019. Of these 36 years, 9 of the years are leap years and 27 of the years are regular calendar years. Refer to the leap years section above if necessary for a review on how to determine whether a given year is a leap year. There are 365 days in a regular calendar year and 366 days in a leap year, so the number of days is calculated as:

365×27 + 366×9 = 13,149 days

Note that if we had not counted the leap years, we would've gotten a result of 13,140 days, and our calculation would have been too small by 9 days.

To calculate the number of days between 10/22/2019 - 01/15/2020 determine the number days in the full months (October and November) between the two dates. Recall from the section above, "Variation in months," that this calculator counts the number of days in the month based on the starting month. Thus, 10/22 - 11/22 is counted as 31 days since there are 31 days in October and 11/22 - 12/22 is counted as 30 days since there are 30 days in November. 12/22 - 1/22 is counted as 31 days, since there are 31 days in December. There are 7 days between the 15th and 22nd of a month, so the number of days between 12/22 and 1/15 can be calculated as 31 - 7 = 24. Thus, between 10/22 and 1/15, there are:

31 + 30 + 24 = 85 days

Summing all of the above together yields:

13149 + 85 = 13,234 days

Thus, there are 13,234 days between 10/22/1983 and 1/15/2020, assuming that the end day was not included. If the end day is included, add 1 day:

13,234 + 1 = 13,235 days