Re: Get min and max dates

2016-12-08 Thread Cousin Stanley
DFS wrote: > > Not wanting to use any date parsing libraries, > If you happen reconsider date parsing libraries the strptime function from the datetime module might be useful #!/usr/bin/env python3 from datetime import datetime dates = [ '10-Mar-1998' , '20

Re: Get min and max dates

2016-12-08 Thread Skip Montanaro
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 d

Re: Get min and max dates

2016-12-08 Thread cantorp
Am Donnerstag, 8. Dezember 2016 14:47:31 UTC+1 schrieb DFS: > On 12/8/2016 12:16 AM, Steven D'Aprano wrote: > > On Thursday 08 December 2016 03:15, DFS wrote: > > > >> dts= ['10-Mar-1998', > >> '20-Aug-1997', > >> '06-Sep-2009', > >> '23-Jan-2010', > >> '12-Feb-2010

Re: Get min and max dates

2016-12-08 Thread Peter Heitzer
DFS wrote: >dts= ['10-Mar-1998', > '20-Aug-1997', > '06-Sep-2009', > '23-Jan-2010', > '12-Feb-2010', > '05-Nov-2010', > '03-Sep-2009', > '07-Nov-2014', > '08-Mar-2013'] >Of course, the naive: >min(dates) = '03-Sep-2009' >max(dates) = '23-Jan-2010'

Re: Get min and max dates

2016-12-07 Thread Steven D'Aprano
On Thursday 08 December 2016 03:15, DFS wrote: > dts= ['10-Mar-1998', > '20-Aug-1997', > '06-Sep-2009', > '23-Jan-2010', > '12-Feb-2010', > '05-Nov-2010', > '03-Sep-2009', > '07-Nov-2014', > '08-Mar-2013'] > > Of course, the naive: