This bit me once. I was comparing a date to a datetime, both representing the same day, so I expected them to be the same, but I was wrong. What I should have done was extracting the date of the datetime with the .date() function, and only then compare it to the other date:
>>> import datetime >>> a = datetime.datetime.today() >>> a datetime.datetime(2015, 9, 16, 16, 57, 45, 150069) >>> b = datetime.date.today() >>> a == b False >>> a.date() datetime.date(2015, 9, 16) >>> a.date() == b True Greetings, -- https://mail.python.org/mailman/listinfo/python-list