Does anyone know how to format a date from a SQL query? I have a webservice
that simply gets the results of a query in a CFC throws it in a dataSet and
then my dataGrid displays the data. One of the fields that is returned is a
date field. In the SQL table the date reads 10/15/2004 but when displayed in
Flash in my dataGrid the date is Fri Oct 15 00:00:00 GMT-0600 2004. I
basically want to format the date to look like the date in the SQL table. I
have read up on schemas and whatnot, and I have the date field formated as date
in my dataSet component schema. It doesn't seem to do anything to the
formatting at all. Also, I have read about #include dateFormat.as. I do not
have that file, everytime I put it in my AS, it says it can't find it. Any
ideas where I can get that file?
I am running the newest version of flash, 7.2 with all the new remoting
comonent updates and what not.
Thanks.
Keith Dodd - 27 Oct 2004 18:57 GMT
Not sure if you need the date to be an actual date object or not. If not, here
is a function I just used so I could display (string) a date returned from my
CF CFC:
function formatDate(useDate:Date):String {
var yr:String = useDate.getFullYear().toString().slice(2);
var myDate:String = ((useDate.getMonth() +1) +"/"+useDate.getDate() +"/" +
yr);
return myDate;
}
for the useDate, I passed the date returned from the cfc.
Hope this helps
Keith