Get min and max dates

Skip Montanaro skip.montanaro at gmail.com
Thu Dec 8 13:01:20 EST 2016


Datetime has greater range I believe. I can't paste from my work computer,
but try this:

min(datetime.datetime.strptime(s, "%d-%b-%Y") for s in dts)

You should get the 1908 date instead of the 1969 date.

In general, you should always use datetime instead of time for doing date
manipulation and date arithmetic. It's a *whole lot better*.

Skip


More information about the Python-list mailing list