Python Date selection

Discussion created by ClawmanSD on May 22, 2014
Latest reply on May 22, 2014 by recurvata
I need to select a number of records in a table, selection by date in each sepperate polygon. The layer has a number of polygons, say A, B, C and each record has a date field value. I need to select the five most resent records by date for each polygon. So area A would have five records selected with the most recent dates. Some areas will have resent date of the current date, some will have date from today but also could go back months or years. So Area 'A' could have five records with todays date, area 'B' could have one for today, one from yesterday and three from last month, etc...

I can select the individual areas, but now when I get to the selection of each date it get harder. I asume there needs to be a counter to note the 5 records and a way to select the dates. So a For i = 0, i <=4, i++ will be needed to count the records, but finding the date is what is getting me. The date is in DD/MM/YYYY format, and field is named 'date_enter'. Any ideas on the query string???