ArcGIS online UTC Time Zone converting to local timezone

7080
33
Jump to solution
11-21-2019 06:44 PM
YashKaja
New Contributor II

We have few DATETIME columns stored in UTC timezone in database. When we view them in ArcGIS online, the timestamps are converted to local timezone, thereby causing the confusion with dates.

"The date and time in a pop-up do not match the date and time in the underlying data."

Followed below articles suggested by support. But no luck. Any thoughts on this issue please? Thanks in advance!

How To: Set the UTC time field to follow a specific time zone 

https://community.esri.com/thread/205882-date-changed-to-strange-values-in-feature-class-when-upload... 

0 Kudos
1 Solution

Accepted Solutions
HamedFarzin1
New Contributor II

Perhaps a way around is to create a new field and using Arcade to translate the ArcGIS online date and time to the local time. 

View solution in original post

33 Replies
HamedFarzin1
New Contributor II

Perhaps a way around is to create a new field and using Arcade to translate the ArcGIS online date and time to the local time. 

YashKaja
New Contributor II

Thanks! It worked via Arcade expression.

0 Kudos
Peter_Klingman
Esri Regular Contributor

Hi Yash,

This is expected behavior - ArcGIS Online Web Applications assume that time fields are in UTC and look at the time zone of the browser/machine, then make the conversion to local time. 

Hamed's suggestion is a good one - in the pop-up or a field calculation you can use the ToUTC or DateAdd functions to convert the values back to UTC: Date Functions | ArcGIS for Developers 

Hope this helps,

-Peter

0 Kudos
YashKaja
New Contributor II

Thanks! I've used Arcade expression for this conversion. But it would've been much easier if it just displays times same as geodatabase.

Peter_Klingman
Esri Regular Contributor

Hi Yash, glad it worked (I saw your response above and marked Hamed's answer correct). This functionality is currently under consideration. If you have a few minutes I would recommend upvoting this idea and providing your use case: https://community.esri.com/ideas/6934 

by Anonymous User
Not applicable

Can I vote for it more than once? Haha

Peter_Klingman
Esri Regular Contributor

If you have multiple Esri accounts I can't stop you 

I would be interested in hearing your specific use case for wanting to override the conversion to local time zone. Per the idea this is something that is being considered for a future update - would you want this to be the case for all your maps and apps? Just specific applications? Would you want to be able to stick the time in a specific time zone for display or rather have it display in UTC only? 

More generally, what apps do you display or use time in, and from where does the data originate? What is the benefit to your organization to not use local time? 

Thanks,

-Peter 

by Anonymous User
Not applicable

I do have multiple accounts, unfortunately they are linked and I can only be counted once lol

I work for the City of Baton Rouge Information Services Department. We support all the municipal agencies and departments, and I more specifically work with public safety/ law enforcement.

So we use 911 Calls for Service (CFS) and reported crime. The data is updated in our SQL database nightly via a .csv file emailed from the Communications District, who maintain the Computer Aided Dispatch (CAD).... here's where it really gets fun... we have older servers and are stuck at 10.4 until, well, the city gets the money to pay for new servers I suppose. Esri won't even support 10.4 after the next update, and not exactly pouring all their resources in to it now.

Long story short, the hosted services we had published on our server with near real time CFS and officer locations suffered catastrophic failures right around the time of the UC and we've been scrambling to do damage control ever since. We've piece milled everything back together except for one very specific date filter issue. Any filter using "is within the last" or similar expressions cause an error accessing the data. I have several dashboards and various apps that show 2 week overviews or similar metrics.The work around we have for now is overwrite the a published feature layer every morning after the SQL update completes to uptake the new data to our portal. <probably more directly what you were asking> The data has several time fields such as CallDate, FirstArrival, ClosedDate and these are based on when they happened as they happened for the officers and witness/ victim or whoever. No one says, I was mugged at 10:00 PM UTC, they'll say the time of day 4:00 PM/ 5:00 PM depending on daylight savings time.

My problem is that when I publish or overwrite using the proper time configurations that data is correct and displays exactly as it should.

CFS in Central Daylight Time [correct time and date]

But when I use the script found here it reverts back to UTC.

CFS time in UTC format [wrong date and time]

I've been wracking my brain trying to figure out what seems like it should be a simple. Passing of the time zone parameter during the overwrite or after it is done.

tl;dr

  • Local government that only deals in Central Time Zone
  • Crime data that has to reflect local time and dates
  • Outdated SQL server database with multiple data feeds into portal environment 
  • Dashboard applications mainly, with a few one off applications for various other LEA projects
0 Kudos
Peter_Klingman
Esri Regular Contributor

Hi Brandon Jumonville‌ thanks for the description of this. It looks like when publishing or overwriting through the UI the publish parameter dateFieldsTimeReference (documentation here: Publish Item—ArcGIS REST API | ArcGIS for Developers) is used, and in the publish call I'm seeing in the script (fs = sdItem.publish(overwrite=True)) there isn't a publish parameters JSON object referenced. To verify this I would capture web traffic with Fiddler when doing each operation and look at the request parameters for the publish call. Then in the script, you can modify the publish params to mirror what you're seeing in the manual publish to hopefully resolve this issue. Here is the guide for how to implement publish parameters into the ArcGIS API for Python's publish call: arcgis.gis module — arcgis 1.8.2 documentation  

0 Kudos