Select to view content in your preferred language

Did the date format change for Query, REST, Post, JSON responses at ags 10?

9160
11
01-04-2011 07:47 AM
KevinGooss
Regular Contributor
On my 9.3.1 server i get this response:

"ORIG_HRZ_COLL_DATE" : "1/5/2011 12:00:00 AM"

But on my 10 server i get this:

"ORIG_HRZ_COLL_DATE" : 1294185600000

Am I in error here or was there some fundamental change made in this area going from ags 9.3.1 to ags 10 or is it in the js api?
If yes, then is there a list of all changes like this somewhere? It's very frustrating to have to find them like easter eggs.
11 Replies
NianweiLiu
Frequent Contributor
I've noticed it too. It is now presented as epoch millisec since 01/01/1970 GMT, and you have to handle timezone too.
0 Kudos
KevinGooss
Regular Contributor
this is disappointing. and to find out this way doesn't make it any easier to swallow.
0 Kudos
KevinGooss
Regular Contributor
The result set at 10 now also includes the data type of each return field in the alias collection that precedes the results. So now you cannot just ignore the data type and return it to the users eyes or else they will see that ugly date value.
Now I'm wondering if there are other types that have been modified.
Not pretty.
0 Kudos
KevinGooss
Regular Contributor
I'm also having issues now with inserting dates into features that I add to ags via my SOE.
If i insert a new record and set the date field to 01/09/2011 and then i turn around and query that feature i get the epoch format back which i convert to .... 01/08/2011.
Is there a time zone issue going on or something?
Perhaps someone who was involved with the changes in the date handling could throw together some notes or, say, documentation about what was done and how to deal with the new way of doing things?
0 Kudos
KellyHutchins
Esri Frequent Contributor
Here are a few links that might help.

This info is from the rest doc:
http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/mapserver.html#response
Support for time-aware map services was added at 10. If the map supports quering and exporting maps based on time, the response will include a timeInfo property which includes information such as the map's time extent and the map's native time reference. However, note that the REST API always encodes time in UTC (milliseconds from epoch).

We also have some information on working with time in the JS API 'Working with time-aware layers' help doc:
http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_temporal.htm
0 Kudos
PeterTimmers
Frequent Contributor
If I had a date field with local time zone datetimes how would I get it to stop showing times 10 hours ahead?

ie. point collected 10am local time gets shown as 8pm.
0 Kudos
DanMcCoy
Frequent Contributor
Kelly,

Is this considered a new feature rather than a bug, then?  There really should be some better documentation explaining why the REST date format has changed between 9.3.1 & 10... and how to handle it in the Web APIs...

Thanks,

Dan
0 Kudos
NickHetrick
Frequent Contributor
The links provided don't help has anyone figured this out. I really don't want to recode my flex app to support this.
0 Kudos
NickHetrick
Frequent Contributor
Luckily the AMF format does not change the date values. Switching to using amf instead of json worked for me in my flex app. Not a solution for others using JS and Silverlight though.
0 Kudos