ActionScript-3 – Date format of Adobe Flex

I have an appointment and I want to format the date:
YYYYMMDD HHMMSS
So for today
20100304 173000

But when I do:

var todayStr:String = today.getFullYear()+today.getMonth()+today.getDay()+today.getHours()+ today.getMinutes();

The problem is that getMonth() sends “3” in March, and I think “03”. I have the same problem this day.

What should I do?

Thank you.

You can use DateFormatter. Take a look at this: Dateformatter @ adobe

var formatter: DateFormatter;
formatter = new DateFormatter();
formatter.formatString = "YYYYMMDD HHNNSS";
formatter.format(dateInstance);

Beware of the use of’N’ in minutes

I have an appointment and I want to format the date:
YYYYMMDD HHMMSS
So for today
20100304 173000

But when I do:

var todayStr: String = today.getFullYear()+today.getMonth()+today.getDay()+today.getHours()+today.getMinutes();

The problem is that getMonth() sends “3” in March , I want to “03”. I have the same problem this day.

What should I do?

Thank you.

You can use DateFormatter. Take a look at this: Dateformatter @ adobe

< /p>

var formatter: DateFormatter;
formatter = new DateFormatter();
formatter.formatString = "YYYYMMDD HHNNSS";
formatter.format(dateInstance);

Beware of the use of’N’ in minutes

Leave a Comment

Your email address will not be published.