【积累】Flex中日期的格式化
在Flex中,有的时候需要对日期做格式化,JAVA中我们已经很熟悉了,Flex中和JAVA大体相同,但是还有一个小小不一样,看下面的例子![](https://i-blog.csdnimg.cn/blog_migrate/4f1150b881333f12a311ae9ef34da474.gif)
2
![](https://i-blog.csdnimg.cn/blog_migrate/4f1150b881333f12a311ae9ef34da474.gif)
3
![](https://i-blog.csdnimg.cn/blog_migrate/4f1150b881333f12a311ae9ef34da474.gif)
4
![](https://i-blog.csdnimg.cn/blog_migrate/1fa987a29c6482f53d401256f96355eb.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/ca75c07623e1b494fee67e8f316fc310.gif)
![](https://i-blog.csdnimg.cn/blog_migrate/9b8a8a44dd1c74ae49c20a7cd451974e.gif)
5
![](https://i-blog.csdnimg.cn/blog_migrate/d18c02628675d0a2c816449d98bda930.gif)
6
![](https://i-blog.csdnimg.cn/blog_migrate/d18c02628675d0a2c816449d98bda930.gif)
7
![](https://i-blog.csdnimg.cn/blog_migrate/d18c02628675d0a2c816449d98bda930.gif)
8
![](https://i-blog.csdnimg.cn/blog_migrate/d18c02628675d0a2c816449d98bda930.gif)
9
![](https://i-blog.csdnimg.cn/blog_migrate/d18c02628675d0a2c816449d98bda930.gif)
10
![](https://i-blog.csdnimg.cn/blog_migrate/8f1ba5b45633e9678d1db480c16cae3f.gif)
Flex3语言参考手册中,关于DateFormatter的formatString是这样解释的:
The following table describes the valid pattern letters:
Pattern letter
|
Description
|
Y
|
Year. If the number of pattern letters is two, the year is truncated to two digits; otherwise, it appears as four digits. The year can be zero-padded, as the third example shows in the following set of examples:
|
M
|
Month in year. The format depends on the following criteria:
Examples:
|
D
|
Day in month. While a single-letter pattern string for day is valid, you typically use a two-letter pattern string.
Examples:
|
E
|
Day in week. The format depends on the following criteria:
Examples:
|
A
|
am/pm indicator.
|
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
|
Minute in hour.
Examples:
|
S
|
Second in minute.
Example:
|
Other text
|
You can add other text into the pattern string to further format the string. You can use punctuation, numbers, and all lowercase letters. You should avoid uppercase letters because they may be interpreted as pattern letters.
Example:
|