[2.5.1] Comparing dates?

Gilles Ganault nospam at nospam.com
Mon Feb 2 06:07:18 EST 2009

On Mon, 02 Feb 2009 20:06:02 +1100, Ben Finney
<bignose+hates-spam at benfinney.id.au> wrote:
>The Python data types for date and time are in the ‘datetime’ module
><URL:http://www.python.org/doc/2.6/library/datetime>. Create a
>‘datetime’ object for each value you want, then compare them.

Thanks guys. For those interested, here's how to perform the
conversion from DD/MM/YYYY to YYYY-MM-DD:

import datetime

connection = datetime.datetime.strptime("21/02/2008",
print connection

More information about the Python-list mailing list