{"secondsUTC":14,"date":16,"dayUTC":5,"minutes":33,"fullYear":2010,"millisecondsUTC":493,"month":3,"monthUTC":3,"seconds":14,"minutesUTC":33,"hours":20,"timezoneOffset":-120,"milliseconds":493,"hoursUTC":18,"dateUTC":16,"fullYearUTC":2010,"day":5,"time":1271442794493}
import com.esri.ags.utils.JSON; import mx.controls.Alert; function testJSON():void { var myDate:Date= new Date(); var jsonDateString:String = JSON.encode(myDate); Alert.show(jsonDateString); }
var now:Date = new Date(); var result:String = JSON.encode({ "date": now.time });
import com.esri.ags.utils.JSON; import mx.controls.Alert; function testJSON():void { var myObject:Object = new Object(); myObject["label"]="test"; myObject["myDate"]= new Date(); var jsonDateString:String = JSON.encode(myObject); Alert.show(jsonDateString); }
import com.esri.ags.utils.JSON; import mx.controls.Alert; function testJSON():void { var myObject:Object = new Object(); myObject["label"]="test"; myObject["myDate"]= new Date().time; var jsonDateString:String = JSON.encode(myObject); Alert.show(jsonDateString); }
Yes, we'll update our encoder to look for Dates and encode them using their time value.