Flex DateField and formats
ugh, what a waste of time on this today. SO, you have a DateField control in your fancy uber high UX’d out BRIA form when the business comes to you and says hey, we want the date formated as: DD/MM/YYYY. Sure says you , cake right? So, you precede to the docs on DateField and see a formatString property that accepts a string the same as DateFormatter.formatString. Yippee! NOT! Using the formatString of DD/MMM/YYYY actually formats to ‘12/02022008′, oops. Ok, so you bust out the labelFunction and bamm! Works a treat. Until you programmatically try setting selectedDate on this DateField that is. You have to set the parseFuntion to null to keep Flex from messing with it and your head. Example code below.
Peas
DK
<mx:Script>
<![CDATA[
private function doDateLabel(item:Date):String {
return dateFormatter.format(item);
}
]]>
</mx:Script>
<mx:DateFormatter id="dateFormatter" formatString="DD/MMM/YYYY" />
<mx:DateField id="begin"
showToday="true"
labelFunction="doDateLabel"
parseFunction="null"/>

Thanks, I hit this problem last week, and couldn’t believe it (and yes, it did mess with my head too!). I got as far as working out I needed to do something with the parseFunction, then I ended up leaving it for another day.
If I can just set that to null, then you’ve saved me a lot of time.
Thanks again.
It’s cool
Hey thanks dude…. I literally banged my head yesterday for this and it all boiled down to this one single line…
Thanks for such a nice example. God bless you
plsy blak jak free…
Hancock.collapsed Okinawa …