ArcGIS Map Service layer query result date values returned as number.

06-14-2016 01:44 AM
New Contributor III

I have arcgis server 10.2. When i make query to rest map service layer, date field values are coming as number in result. Field type is Date and value is "02/06/16 12:51:25 م". But query result is "1464870816000".  But the value return correctly in Identify function. Is there a solution for this problem.


0 Kudos
3 Replies
MVP Regular Contributor

It is returned as a Unix time string.  You can convert it directly to a time string:

var d = new Date(1464870816000);
console.log( d.toDateString() );
// edit: add formatting
console.log( d.format("dd/mm/yyyy hh:MM:ss") );
New Contributor III

Yes i know, but i have many layers and many fields. We are using these values in datagridviews or other views. It is difficult to format each date field for display purpose. I am looking a solution to get date values directly as date. Date values comes correctly on 'Identify' function.

0 Kudos
Esri Regular Contributor

As of now, that is expected behavior - query operation always returns raw (unformatted) data while identify returns formatted results. Query results get used in many different ways -- data storing, drawing, sorting -- with formatted results, those usages get limited... in addition, it gives the client app to format data/time according to the client locale etc.