For my web application, I have a FeatureSet that returns the attribute table of a feature layer, and in that table, there is a date field (esriFieldTypeDate) that I must print. However, when I try that, I get an 11- to 12-digit integer instead of the typical MM/DD/YYYY date string.
The strange thing is, when I use the Query Related Records tool from the ArcGIS Services page, it actually parses the date field correctly... but the source of that page doesn't give any clues as to how it did.
So, for instance, I get the following:
51494400000 instead of 1971/08/20 00:00:00 UTC
50889600000 instead of 1971/08/13 00:00:00 UTC
779328000000 instead of 1994/09/12 00:00:00 UTC
Is there a pattern I'm not seeing? Is there a special way to parse these integer dates?
Thanks
Daniel
I have been stuck on this all afternoon. My day and month was always one below what it should have been. Adding plus one as you did solves the problem, thanks. My question is: Why do we have to do this? Is there a bug in the data conversion or am I doing it wrong?
_covDate = new Date(myAttributes.RecordDate);
<s:Label text=" {_covDate.getMonth() + '/' + _covDate.getDate() + '/' + _covDate.getFullYear() }"/>
if(ldf.type=="esriFieldTypeDate"){ field_val= dojo.date.locale.format(new Date(field_val), {datePattern: "MM/dd/yyyy"}); }
dojo.require("dojo.date.locale"); _covDate = new Date(myAttributes.RecordDate); var _covDateStr = dojo.date.locale.format(_covDate, { selector: 'date', datePattern: 'MM/dd/yyyy' });
Daniel
Adding plus one as you did solves the problem, thanks. My question is: Why do we have to do this? Is there a bug in the data conversion or am I doing it wrong?