In the variable dates, you are receiving several dates in string
as array
, I want to bring the smaller
cont = 0
menor_data = datetime.strptime('31/12/2300', '%d/%m/%Y')
while cont < len(datas):
data_d = datetime.strptime(datas[cont], '%d/%m/%Y').date()
if data_d < menor_data:
menor_data = data_d[cont]
cont = cont + 1
print(menor_data)
Returns the following error:
Traceback (most recent call last):
in
if data_d < menor_data:
TypeError: can not compare datetime.datetime to datetime.date