I am using python 3.6 and got some problems to calculate date.
I have a list composed of date elements like below:
dates = [['2017','01','15'], ['2017','01','14'], ['2017','01','13'],...]
I would like to make it to time format and calculate the days from today.
How can I fix my code?
Below is my code:
dates = [['2017', '01', '15'], ['2017', '01', '14'], ['2017', '01', '13']]
for date in dates:
date_cand = "-".join(date)
date_cand_time = time.strptime(date_cand,"%Y-%m-%d")
(datetime.date.today() - datetime.date(date_cand_time)).days
I have this error message now:
TypeError: an integer is required (got type time.struct_time)
The result that I would like to have is:
4
5
6
Please help me to work this out.