Select to view content in your preferred language

How to work with Time Zones?

4165
1
06-01-2015 06:26 PM
SimonJackson
Occasional Contributor III

I have a basic app built using the 3.13 Esri Javascript API, very close to this sample.

I originally published the temporal layer with the correct time zone for the data.

TimeZone_ArcMap.png

Publishing this to an ArcGIS for Server 10.3 instance, I can see that this has flowed through to the REST endpoint:

1.png

The Time Extent of the time data, is 5am to 10am on 27/04/2015, AUS EST.

So the above UTC time is technically correct.

Adding this layer to my app, and using the standard time widget provided in the Esri JS API, I have some issues.

Viewing the app here in Melbourne (same time zone as service), everything is good.

Can see the labels are correctly populated from the service, spanning 5am to 10am.

Good.png

Howeverer, viewing the app from a machine in a different time zone, and it seems to use their local time zone:

FromUSA.png

I saw some other posts where they mention to do things like publish in UTC and add/minus the relevant number of hours? 

Is that the right answer?  What is the best way of dealing with time zones when publishing to Server and having an audience that will be coming from different time zones?  Is there a parameter I am missing in the Javascript properties of my service to enforce the Server timezone to all clients?  Any info on best practice would be really useful.

0 Kudos
1 Reply
GeorgieCassar
Occasional Contributor

Good question SImon.  I've been having similar issues myself where I don't want the stored date to be altered at all. The map service stores the correct date but somehow the Browser assumes they are UTC and adds the Adelaide timezone to it.

Originally For my problem I thought I'd use the standard javascript function getTimeZoneOffset() which tells me the difference between the utc time and local time.  Then I'd apply that difference to all my dates.

However, I can't apply this the the underlying data that my timeslider is reading. Looks like I need to go back into my map service mxd and apply local time zone settings.  Then the local client here should not adjust them.  I found a useful link about this: https://community.esri.com/message/49039#49039

0 Kudos