I need to compare 2 dates with a IF, but for some strange (:P) reason, I can’t do it.
My code
date1 = strftime("%Y-%m-%d")
d2 = os.path.getmtime('/tmp/file')
date2 = datetime.date.fromtimestamp(d2)
if date1 == date2 :
print 'same date'
else:
print 'different date'
I don’t know why, show with a print the same date, but, with this IF shows ‘different date’
Maybe is a newbie question, sorry !
Thank you !
date1is a string, anddate2is adatetime.date. Perhaps you meantdate1 = datetime.date.today().