MikeEdwards

Retrieve Unique Dates From Attribute Field

Discussion created by MikeEdwards on Oct 18, 2017
Latest reply on Oct 19, 2017 by bixb0012

Hello,

 

I'm trying to pull all of the unique dates out of an attribute field and I'm having issues formatting the output. Right now I have the following:

 

table = r"C:\Temp\SomeFile.shp"
field = "ADD_DATE"
valueList = []
rows = arcpy.SearchCursor(table)

   for row in rows:
      valueList.append(row.getValue(field))

 

uniqueSet = set(valueList)
uniqueList = list(uniqueSet)
uniqueList.sort()


del rows
del row

print uniqueList

 

The output is datetime.datetime(2017, 9, 19, 14, 28, 29) I'd like it to simply be 2017/09/19

 

Can anyone help?

Outcomes