How can i convert string datatype to date datatype in flex

Nidhi picture Nidhi · May 12, 2010 · Viewed 8.9k times · Source

I have to convert one string type field to date datatype in flex.

What can I do solve this problem?

Answer

invertedSpear picture invertedSpear · May 12, 2010
import mx.controls.DateField;

var dateString:String = " 25/02/2009";
var date:Date= DateField.stringToDate(dateString,"DD/MM/YYYY");

with credit to: http://amthekkel.blogspot.com/2009/02/flex-converting-date-string-to-date.html