Can you show more of your code? I have a similar issue from an attribute query. The Graphic(s) contained in the returned FeatureSet contain attributes of esriFieldTypeDate but it's not displaying in any known date format. If your code above works, how are you detecting that the attribute is of the date format?
Hello,
Here's the way I'm dealing the date format returned in esriFieldTypeDate type in an ItemRenderer :
data.datereservon = the value in esriFieldTypeDate from the FeatureLayer
dfData = Datefield in ItemRenderer.
It's certainly not the most elegant way of coding it but it gives complete control on the final "look" of your date.
Hope it helps ...
protected function parseDateResOn():void | ||||
{ | ||||
YourDateFormatterID.formatString = "DD/MM/YYYY"; | ||||
var dateOn:Date = new Date(data.datereservon); | ||||
var dayFromDateStringed:String = dateOn.date.toString(); | ||||
var monthFromDateStringed:String = dateOn.month.toString(); | ||||
var yearFromDateStringed:String = dateOn.fullYear.toString(); | ||||
var dateResOn:String = dayFromDateStringed + "/" + monthFromDateStringed + "/" + yearFromDateStringed; | ||||
dfData.text = dateResOn; | ||||
//data.datereservon = dateResOn; | ||||
} |
Pierre,
Here is another way:
import spark.formatters.DateTimeFormatter;
var dateFormatter:DateTimeFormatter = new DateTimeFormatter();
var dateOn:Date = new Date(data.datereservon);
dateFormatter.dateTimePattern = "DD/MM/YYYY";
dfData.text = dateFormatter.format(dateOn);
Short and efficient, thanks a lot Robert for sharing the best practices in Flex coding !
Pierre.