I am very new to python and I've run across a small problem that I haven't been able to find an answer to by googling. I am running the following code:
from dateutil import relativedelta as rdelta
def diff_dates(date1, date2):
return rdelta.relativedelta(date1,date2)
d1
and d2
are two separate dates
years = diff_dates(d2,d1)
print "Years: ", years
The values that get printed out for years are the correct values that I'm expecting. My problem is that I need to access those values and compare against some other values. No matter how I try to access the data I get similar errors:
AttributeError: relativedelta instance has no __call__ method
I need to get the years, months, and days and any help would be greatly appreciated.