📜  如何比较当前日期和未来日期 pythono - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:07.888000             🧑  作者: Mango

代码示例1
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")