I'm trying to get the current time, and compare it with a date taken from a string. This is the code I have:
import datetime
CurrentDate = str(datetime.datetime.now())
CurrentDate = datetime.strptime(CurrentDate, "%d/%m/%Y %H:%M")
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")
But this is the error I get.
CurrentDate = datetime.strptime(CurrentDate, "%d/%m/%Y %H:%M") AttributeError: 'module' object has no attribute 'strptime'