This content has been marked as final. Show 3 replies
Wow, all of 20 minutes after I post, I find the answer on another website.
Apparantly you need to use a dateFormatter component, and create a function that tells the dateFormatter to format the date instead of the normal parse. Perhaps this is a bug in the dateField component?
"MMM" seems to work fine for me. Here is my code:
var dateString:String = "09-13-1978";
var formatMask:String = "DD/MMM/YYYY";
var dateFormatter:DateFormatter = new DateFormatter;
dateFormatter.formatString = formatMask;
var formattedDate:String = dateFormatter.format(dateString);
This gives me "13/Sep/1978".
Not sure where your's is going wrong. Show us more of your code....
The code that did not work is this:
<mx:DateField id="Date2" formatDate="DD/MMM/YYYY">
As you can see, I was not using any scripting at all, attempting to do this purely in the mxml declaration of the object. But this formatDate displays "28/02022008" for todays date, when I would assume it would display "28/Feb/2008"
The scripting method, using a dateFormatter works fine.