I have a featureclass with a 'date' class field named 'ACQ_DATE' formatted as:
etc. As you can see the number of digits is not harmonized. I want to display the dates on a graduated colour scale in the symbology (i.e. earliest date: red, latest date: green), but I understand that graduated colours are not applicable to a date field. Therefore, I want to transform the date to an integer which is supported by graduated colours. The integer should be in the format:
I've tried the following python code block, but it doesn't work.
date=str(!ACQ_DATE!) year= date.split("-") month= date.split("-") day= date.split("-") dateInt= year * 10000 + month * 100 + day
This code gives a syntax error, but I'm not sure what's wrong with it. I'd appreciate any suggestions to convert a date field to an integer field. Thanks in advance.
UPDATE! A good solution was provided by a colleague. Write in the calculator: