AnsweredAssumed Answered

Calculate Time Difference

Question asked by Ernestocd on Apr 27, 2016
Latest reply on Apr 28, 2016 by Dan_Patterson


I have a python script that used to work to calculate difference in dates outputting the result in days. It worked fine since last week until we migrated to 10.4. To my understanding, this should not matter but just as en extra info.

 

(datetime.datetime.now() - arcpy.time.ParseDateTimeString( !DATE! )).days

 

The following error is returned:

Executing: CalculateField gishw.PU.MapChangeRequest Time_Diff (datetime.datetime.now() - arcpy.time.ParseDateTimeString( !DATE! )).days PYTHON_9.3 #

Start Time: Wed Apr 27 10:24:54 2016

ERROR 000539: Error running expression: (datetime.datetime.now() - arcpy.time.ParseDateTimeString( u"4/26/2016 4:10:00 PM" )).days

Traceback (most recent call last):

  File "<expression>", line 1, in <module>

NameError: name 'arcpy' is not defined

 

 

Failed to execute (CalculateField).

Failed at Wed Apr 27 10:24:54 2016 (Elapsed Time: 0.13 seconds)

 

Any assistance will be appreciated.

Outcomes