+ 1

I want to know they diference between two dates in days so i script this code but for some reason it do nota work, please help

import datetime fd = input()#mm dd, yyyy sd = input()#mm dd, yyyy x= fd.split(" ") y= sd.split(" ") x[1]=x[1].replace(",","") y[1]=y[1].replace(",","") a = date(x[2],x[0],x[1]) b = date(y[2],y[0],y[1]) c= (a-b) print(c)

23rd Apr 2022, 11:11 AM
Jovanny Becerra
Jovanny Becerra - avatar
1 Answer
+ 3
You need to call date class through datetime reference.. And must convert argument to int types... Like this : a = datetime.date(int(x[2]),int(x[0]),int(x[1])) b = datetime.date(int(y[2]),int(y[0]),int(y[1])) Hope it helps..
23rd Apr 2022, 11:27 AM
Jayakrishna 🇼🇳