I have a GeoEvent Service running that populates an attribute field in a feature with the currentTime() every minute. This is fine for features that sit within UTC. I have features that range from UTC-4 to UTC+7. I figured I could have a "Time Difference" attribute with the numeric time difference (in milliseconds perhaps?) and put in a filed calculator to my GeoEvent Service. I have not been successful yet. Any advice would be appreciated.
How do you know what timezone each feature comes from? Could you have a different input connector per region?
Each feature is a static location. I just need to display the local time at each feature location.
I'm not entirely clear on the architecture and current approach. It sounds like there a series of devices which are each individually pushing information at GEE. GEE is then persisting the updates to individual features within a single class within the geodatabase. The updates from the device do not contain local date/time and instead you are asking GEE to populate a field with a date/time value. Is that correct? How are you currently trying to populate the field?
Something feels wrong about the premise of persisting the local date/time of each device. The default for ArcGIS Server and the Geodatabase is to persist and publish out data in UTC. If not UTC, then a consistent timezone rather than a mix.
Hi Philip,
Apologies, I'm not explaining the situation clearly.
There is a feature class loaded to our Enterprise Geodatabase representing locations across the globe. I am using a "Poll an ArcGIS Server for Features" input and "Update a Feature" output (both pointing at the same dataset) with two Field Calculators between them. One Field Calculator is using currentTime() as the expression and the idea for the second was to calculate the local time based on a time difference attribute (Current_UTC_Time +/- Time_Difference).
The idea being that a user can click on a feature and see what the current local time is at each location or have this information in an Operations Dashboard as users scroll through the locations.
I hope that clarifies the current setup.
Cheers,
Barry
Ok, I understand the problem you're seeking to resolve now.
I wouldn't recommend GEE for this type of scenario. Firstly, it's using a very big hammer to crack a relatively small nut. The true capabilities of GEE aren't being utilised. Secondly, as you're finding out, diagnosing issues with this type of solution would be very hard to trouble shoot.
I'd suggest you look to do something within your client app. Assuming Time_Difference to be a field within the feature, I'd look at apply an Arcade script - or similar.
Date Functions | ArcGIS for Developers
DateAdd(Date(), -23, 'hours')
DateAdd(Date(), 23, 'hours')
DateAdd(Date(), $feature.Time_Difference, 'hours')
Thanks for the advice Philip. I've gone that route and am using a simple label instead. All this is on ArcGIS Online btw...
var uktime = DateAdd(Now(), 0, "hours");
var dst = DateDiff(TimeStamp(), uktime, "hours");
var mytime = DateAdd(TimeStamp(), $feature.Time_Difference - dst, "hours")
Text(mytime, 'HH:mm');
Where Time_Difference is an attribute that has the difference from GMT.