0

How to compare current date to future date in Python

Python
import datetime

CurrentDate = datetime.datetime.now()
print(CurrentDate)

ExpectedDate = "9/8/2015 4:00"
ExpectedDate = datetime.datetime.strptime(ExpectedDate, "%d/%m/%Y %H:%M")
print(ExpectedDate)

if CurrentDate > ExpectedDate:
    print("Date missed")
else:
    print("Date not missed")

output

2015-09-09 12:25:00.983745
2015-08-09 04:00:00
Date missed
add comment
Suggest a different solution or add another example