date-math

Best way to find the months between two dates

Best way to find the months between two dates Question: I have the need to be able to accurately find the months between two dates in python. I have a solution that works but its not very good (as in elegant) or fast. dateRange = [datetime.strptime(dateRanges[0], “%Y-%m-%d”), datetime.strptime(dateRanges[1], “%Y-%m-%d”)] months = [] tmpTime = dateRange[0] …

Total answers: 41