<
mx:DateFormatter
id
=
"formatDateTime"
formatString
=
"MM/DD/YY"
/>
the formatString will determine how your date &
time is formatted. I have created a pattern chart below that’s a little
easier to read then the one on Adobe’s Flex Documentation.
OK now on to applying it to a date with funky database formatting
Pattern | Example |
Year | |
YY | 09 (Year Number Short) |
YYY | 2009 (Year Number Full) |
YYYY | 02009 (I have no clue why you would need this) |
Month | |
M | 7 (Month Number Short) |
MM | 07 (Month Number Full) |
MMM | Jul (Month Name Short) |
MMMM | July (Month Name Full) |
Day | |
D | 4 (Day Number Short) |
DD | 04 (Day Number Full) |
Day Name | |
E | 1 (Day Number Short) |
EE | 01 (Day Number Full) |
EEE | Mon (Day Name Short) |
EEEE | Monday (Day Name Full) |
A | AM/PM |
J | Hour in day (0-23) |
H | Hour in day (1-24) |
K | Hour in AM/PM (0-11) |
L | Hour in AM/PM(1-12) |
N | 3 (Minutes) |
NN | 03 (Minutes) |
SS | 30 (Seconds) |
<
mx:DateFormatter
id
=
"formatDateTime"
formatString
=
"MM/DD/YY"
/>
<
mx:DataGridColumn
headerText
=
"Date"
>
<
mx:itemRenderer
>
<
mx:Component
>
<
mx:VBox
>
<
mx:DateFormatter
id
=
"formatDateTime"
formatString
=
"MM/DD/YY"
/>
<
mx:Label
text="{formatDateTime.format(data.myDate) }/>
No comments:
Post a Comment