AnsweredAssumed Answered

EsriTimeDelta = a string as GetParameterAsText Please Help, I need this answered ASAP

Question asked by cgarlock on Apr 14, 2013
Latest reply on Apr 15, 2013 by cgarlock
I'm trying to set units to a string and then as a parameter. The EsriTimeDelta syntax is EsriTimeDelta (interval, units)

When I run the code below in a script tool I keep getting an error message for the units, it will fail to run the script.

If there is an easier way please help! I need this question answered by Monday.


 df.time.currentTime = datetime.datetime(2009, 01, 1, 00, 00)  endTime = datetime.datetime(2009, 01, 1, 23, 59) tsi = arcpy.GetParameterAsText(1) units = "'" + arcpy.GetParameterAsText(2) interval = arcpy.time.EsriTimeDelta(tsi, units)  


In this code I get an error saying that the interval must be a float. But the interval (double) units (string) according to the help.
I also didn't set the units to a string in this instance and the script would actually run. But now I'm getting the error I just mentioned.


 df.time.currentTime = datetime.datetime(2009, 01, 1, 00, 00)  endTime = datetime.datetime(2009, 01, 1, 23, 59) tsi = arcpy.GetParameterAsText(1) units = arcpy.GetParameterAsText(2) interval = arcpy.time.EsriTimeDelta(tsi, units)  count = 0  while df.time.currentTime <= endTime:     fileName = str(df.time.currentTime).split(" ")[0] + str(count) + ".jpg"     arcpy.mapping.ExportToJPEG(mxd, os.path.join(inFolder, fileName), data_frame)     df.time.currentTime = df.time.currentTime + interval     count += 1 

Outcomes