FLEX中的格式化日期

可以在页面中加入 <mx:DateFormatter id="ID " formatString=" 格式 " /> 来实现格式化日期

 

调用的时候在 AS 使用 : ID .format(new Date()); 实现格式化

 

 

格式化日期的掩码 :

 

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:

 

  • YY = 05
  • YYYY = 2005
  • YYYYY = 02005

M

 

 

Month in year. The format depends on the following criteria:

 

  • If the number of pattern letters is one, the format is interpreted as numeric in one or two digits.
  • If the number of pattern letters is two, the format is interpreted as numeric in two digits.
  • If the number of pattern letters is three, the format is interpreted as short text.
  • If the number of pattern letters is four, the format is interpreted as full text.

Examples:

 

  • M = 7
  • MM= 07
  • MMM=Jul
  • MMMM= July

D

 

 

Day in month. While a single-letter pattern string for day is valid, you typically use a two-letter pattern string.

 

Examples:

 

  • D=4
  • DD=04
  • DD=10

E

 

 

Day in week. The format depends on the following criteria:

 

  • If the number of pattern letters is one, the format is interpreted as numeric in one or two digits.
  • If the number of pattern letters is two, the format is interpreted as numeric in two digits.
  • If the number of pattern letters is three, the format is interpreted as short text.
  • If the number of pattern letters is four, the format is interpreted as full text.

Examples:

 

  • E = 1
  • EE = 01
  • EEE = Mon
  • EEEE = Monday

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:

 

  • N = 3
  • NN = 03

S

 

 

Second in minute.

 

Example:

 

  • SS = 30

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:

 

  • EEEE, MMM. D, YYYY at L:NN A = Tuesday, Sept. 8, 2005 at 1:26 PM

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值