I would like some information on how to add a date to an attribute table, by adding a user specified date in a script tool that will update the polygons attribute table. In short I have two polygons that I wish to calculate the difference in time, in hours between them. The date is determined by specification inside a script box, seen in the image below.
I would like to use code that goes along with my tool and I need to figure out what I'm missing in the following code; (This is the simple code for the tool)
import arcpy
Mother1 = sys.argv[1]
date1= sys.argv[2] ### I believe date style is in format mm/dd/yyyy hh:mm:ss
Mother2 = sys.argv[3]
date2 = sys.argv[4]
try:
arcpy.AddField_management(Mother1,"Date","DATE","#","#","#","#","NULLABLE","NON_REQUIRED","#")
arcpy.AddField_management(Mother2,"Date","DATE","#","#","#","#","NULLABLE","NON_REQUIRED","#")
Then, I tried adding the date to the field such as this;
arcpy.CalculateField_management(Mother1, "Date", date1)
arcpy.CalculateField_management(Mother2, "Date", date2)
But that did not work.
I would like to add the date to the attribute table and then also be able to calculate the difference between the two dates, but need to get the date into the attribute table before I can calculate anything?