[Tutor] Datetime objects

Steven D'Aprano steve at pearwood.info
Sat Mar 17 01:08:47 CET 2012


Luke Thomas Mergner wrote:
> Hi,
> 
> I am having trouble comparing two datetime objects.

No you're not. You're having trouble comparing a datetime and a date object.

[...]
> But when I compare them, it always returns false because datetime.date does
> not seem to compare to datetime.datetime...

Use date_obj.date() to return a date object without the times, then compare
that to the date objects sqlalchemy gives you.



-- 
Steven



More information about the Tutor mailing list