AnsweredAssumed Answered

How do I format the date field from a querytask results featureset.

Question asked by gslim on Sep 10, 2014
Latest reply on Sep 10, 2014 by khutchins-esristaff

I am using the  https://developers.arcgis.com/javascript/jssamples/query_nomap.html sample to get a html table of the feature attributes.  My date fields are being returned as numbers.  Is there anyway to catch get them back as date fields so they look like dates?

 

Shane

          

function showResults(results) {
    var resultItems = [];
    var resultCount = results.features.length;
    for (var i = 0; i < resultCount; i++) {
        var featureAttributes = results.features[i].attributes;
        for (var attr in featureAttributes) {
            var attrAlias = results.fieldAliases[attr];
            var attValue = featureAttributes[attr];
            if (attValue == null) {
                attValue = "";
            };
            resultItems.push("<tr><td class='width-fixed'>" + attrAlias + ":</td><td class='width-variable'>  " + attValue + "</td></tr>");
        };
        resultItems.push("<br>");
    };
    dom.byId("info").innerHTML = resultItems.join("");
};

Outcomes