Hi, i wanna compare two dates with this line but an error occurs :
This is the print of my two dates (they have the same format) :
if idProd.last_synchro_ingram < date:
date = 2016-03-02
idProd.last_synchro_ingram = 2016-03-09
I tested with it and it didn't work :
DEFAULT_SERVER_DATE_FORMAT = "%Y-%m-%d"
if datetime.strptime(idProd.last_synchro_ing, DEFAULT_SERVER_DATE_FORMAT) < datetime.strptime(date, DEFAULT_SERVER_DATE_FORMAT):
print "idProd.last_synchro_ing < date"
if datetime.strptime(idProd.last_synchro_ing, DEFAULT_SERVER_DATE_FORMAT) > datetime.strptime(date, DEFAULT_SERVER_DATE_FORMAT):
print "idProd.last_synchro_ing > date"
Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!
About This Community
|Asked: 3/9/16, 10:47 AM|
|Seen: 478 times|
|Last updated: 3/11/16, 4:08 AM|