1

I am trying to use DateDiff to calculate the difference between today's date and the initiated date of various projects. I created a new field called "Duration of Day" and I tried the calculation: DateDiff("d", [INITATIEDATE], Now()) , this however keeps coming up as an error and will not work.

How do I make this calculation work in ArcGIS Desktop 10.4.1?

  • 1
    What software are you using? – Matte Aug 2 '17 at 15:26
  • seems arcmaps field calculator (guessing). Here are the help docs. be sure your date fields are formatted correctly as well . desktop.arcgis.com/en/arcmap/10.3/manage-data/tables/… – NULL.Dude Aug 2 '17 at 15:28
  • Using ArcMap 10.4.1. Trying the calculation in the field calculator using VB Script. I'm open to using python script but I am not really familiar with that way. – Leslie Aug 2 '17 at 15:28
  • 1
    intialdate field is formatted as a date field correct? – NULL.Dude Aug 2 '17 at 15:29
  • yes initated date is formatted as a date field. it's formatted like yyyy-mm-ddT00:00:00.000Z – Leslie Aug 2 '17 at 15:31
1

I just tested this out using your script above on my own data and it worked. However my original_date field is formatted "MM/DD/YYYY". the above VBS Script succeeded in calculating the duration of days from current date.

Reformat your date field to use the above format. http://desktop.arcgis.com/en/arcmap/10.3/manage-data/tables/fundamentals-of-date-fields.htm

  • How do I reformat dates in arcmap? – Leslie Aug 2 '17 at 17:43
  • few ways you can do this, you can use slicing(indexing) to place the index in the order you want with python, or you can try the method I linked, I have not tried this but it may work gis.stackexchange.com/questions/202838/… – NULL.Dude Aug 2 '17 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.