Skip to content
Advertisement

Calculate the total days between a range of dates using Python

I have a list of date ranges and want to find the total number of days between those ranges. However, the ranges may, or may not, have overlap. And I want to exclude overlapped time. There may also be gaps between the ranges which I also want to exclude.

I’m curious on the most optimal way to calculate this.

An example:

JavaScript

Total range time in days — 1/1/2000 through 1/1/2002 + 1/1/2003 through 1/1/2004

Advertisement

Answer

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement