Web Map shows wrong "beach sampling date" in popup window

1184
4
07-07-2011 01:17 PM
DonBarker
Occasional Contributor
I created a web map of beach monitoring sites and results for San Mateo County Calif.  The popup includes the sampling date.  The date in the popup does not match the date in the underlying data (feature service or shapefile or Excel table).  For example:

Data says 7/5/2011,   web map popup shows  7/4/2011 5:00 PM
Data says 5/17/2011, web map popup shows 5/16/2011 5:00 PM

This is consistently wrong for all the map points in all the popups.

The operational layers are on an ArcGIS server behind our county firewall, so you can't see them.  So I've documented and illustrated the problem in the attached 2-page PDF.  I hope you'll take a look and help figure this out.

Thanks.
Tags (2)
0 Kudos
4 Replies
MikeMinami
Esri Notable Contributor
The server stores dates in UTC (Universal Time, Coordinated). The web browser converts the date to local time, which is UTC -8 for California (now -7 due to daylight savings time). Thus, all of your date displays are offset 7 hours earlier. So given a date like 7/7/2011 without a time (midnight) will display as 7/6/2011 5pm. This is just how dates work.

http://en.wikipedia.org/wiki/Coordinated_Universal_Time

I am assuming that the field in question is actually of type "date". Is this a time aware layer? The layer properties dialog in ArcMap (Time tab) lets you specify a time offset. You might try to enable an offset and serve your map out again. I'm not sure it will work with queries against the data, however, and I didn't try it myself. Another option would be to add a string field that represents the date. The browser won't convert the string field in this case.

Thanks,

Mike
0 Kudos
DonBarker
Occasional Contributor
Great, Mike.  This makes sense.

Thanks for taking time to reply with explanation and suggestions.
0 Kudos
RichardCitkowicz
New Contributor III
I am uploading a feature class from ArcMap 10.1 without a date edit and date created field and turning this on after the feature service is published.
0 Kudos
JamesGraham
New Contributor III

The responses here identify the problem, but the resolution is actually present in the ArcGIS/ArcMap documentation here:

Calculate Field examples—Help | ArcGIS for Desktop

A slight tweak the examples gives the resolution, using the Field Calculator:

arcpy.time.ParseDateTimeString(!field1!) + datetime.timedelta(hours=12)

0 Kudos