Answers for "how to compare date with current date in python"

0

how to compare current date to future date pythono

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")
Posted by: Guest on March-26-2020

Code answers related to "how to compare date with current date in python"

Python Answers by Framework

Browse Popular Code Answers by Language