Question

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.

Was it helpful?

Solution

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());

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top