I've been asked to create an Arcade script that calculates the difference between the start and end date of a project. The value should populate an integer field with hours. The start and end date fields are formatted with date and time, because we need to track to the hour how long is spent working on the project.
I have the below script and fields. I would like to implement this as an attribute rule going forward. Any idea how to get it to automatically populate the TimeDiff field? I'm assuming the inclusion of time is the issue, but I need to include it.
Solved! Go to Solution.
This works:
var StartDate = $feature.TimeStart
var EndDate = $feature.TimeEnd
var TimeDiff = DateDiff(EndDate, StartDate, 'hours')
return TimeDiff
This works:
var StartDate = $feature.TimeStart
var EndDate = $feature.TimeEnd
var TimeDiff = DateDiff(EndDate, StartDate, 'hours')
return TimeDiff