vendredi 7 avril 2017

python datetime module and if statements

I am beginner making a small project to calculate something. I need my program to use certain numbers depending on the date. I want the program to do something if the manufacturing date is between two dates. this is what i have so far:

import datetime
ManufacturingDate = input('ManufacturingDate: ')
ManufacturingDate = datetime.datetime.strptime(ManufacturingDate,"%d/%m/%Y")

if (ManufacturingDate >= datetime.date(1/1/2001) and <= datetime.date(31/1/2008)):
    #do something

Aucun commentaire:

Enregistrer un commentaire