Hi,
I wrote this method to do that for me a while back. As long as the format of the database element is ODBC, this should work.
ActionScript Code:
Code:
String.prototype.stringToDate = function() {
// establish the string to be converted to a date
// ----------------------------------------------------------------
var strODBC = this.toString();
// convert various date parts into numbers
// ----------------------------------------------------------------
// get year and convert to a number
var strYear = strODBC.substr(strODBC.lastIndexOf(" ")+1);
var numYear = number(strYear);
// get month and convert to a number
var strMonth = strODBC.substr(4,3);
var numMonth;
for(i=0;i<monArr.length; i++){
if(monArr[i]==strMonth){
numMonth = i;
break;
}
}
// get day (i.e. date) and convert to a number
var strDate = strODBC.substr(8,2);
strDate = strDate.Trim();
var numDate = number(strDate);
// return a new date object with the proper date numbers
// ----------------------------------------------------------------
var thisDate = new Date(numYear,numMonth,numDate);
return thisDate;
}
// end string.stringToDate() method Regards,
A.Ramesh