What you need to know?
1. The format
2. How to format
i. using date formatter =>
ii. calling date formatter => formatDateTime.format(YourDate);
1. The format
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) |
2. How to format
i. using date formatter =>
<
mx:DateFormatter
id
=
"formatDateTime"
formatString
=
"MM/DD/YY"
/>
ii. calling date formatter => formatDateTime.format(YourDate);