开发者

Flex 4 convert the month value of a date to its string equivalent

开发者 https://www.devze.com 2023-03-31 01:58 出处:网络
I\'d like to convert a Flex 4 Date object to string in the format of \"25 Aug 11\". I thought this would be easy using DateField.dateToString(today,\"DD mmm YY\"); however the code outputs 25 0808 1

I'd like to convert a Flex 4 Date object to string in the format of "25 Aug 11".

I thought this would be easy using DateField.dateToString(today,"DD mmm YY"); however the code outputs 25 0808 11 where 0808 should be Aug. What is the proper syntax to pull the 3 letter month value?

What I'm I missing here, is there a way in flex other than开发者_开发百科 hardcoding an array of Month values like {"Jan", "Feb", ..."Dec"} and then accessing the string via the index.

Any help would be great.


Figured it out 2 minutes after posting. Instead of using DateField I used DateFormatter with a format string of DD MMM YY.

In the AS I did:

dateLabel.text = "As of " + asOfDateFormatter.format(new Date());

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号