I have a String in the format "20-Aug-2008". I want this to be converted to either 20/08/2008 or 08/20/2008? How can I do this?
I just want to remove all those hyphens from the String and convert it to a date value. The dateFormatter function accepts only date values in the format mm/dd/yyyy.
Can someone help me out..
I used regex and removed all those hyphens,from the String. Now in an array I have the values, 20,Aug and 2008. How to proceed after that to convert to 20/08/2008?
Edit
[Bindable]public var myDate:Date;
public function init():void
{
var dateStr:String="20-Aug-2008";
var rex:RegExp = /-/;
var dateArray:Array = dateStr.split(rex);
myDate= new Date(dateArray[0],dateArray[1],dateArray[2]);
}
<mx:DateFormatter id="DateDisplay" formatString="MM/DD/YYYY"/>
<mx:TextArea id="date" text="{DateDisplay.format(myDate)}"/>
The value I get in the text area is: 01/00/NaN. Where have I gone wrong?