DateFormatter formats a given date with a specified pattern.
Use the declared constants as placeholders for specific parts of the date-time.
All characters from 'A' to 'Z' and from 'a' to 'z' are reserved, although not
all of these characters are interpreted right now. If you want to include plain
text in the pattern put it into quotes (') to avoid interpretation. If you want
a quote in the formatted date-time, put two quotes directly after one another.
For example: "hh 'o''clock'".
Example:
var formatter:DateFormatter = new DateFormatter("dd.mm.yyyy HH:nn:ss S");
trace(formatter.format(new Date(2005, 2, 29, 18, 14, 3, 58)));
Output:
29.03.2005 18:14:03 58
static public DEFAULT_DATE_FORMAT:Stringstatic public YEAR:Stringstatic public MONTH_AS_NUMBER:Stringstatic public MONTH_AS_TEXT:Stringstatic public DAY_AS_NUMBER:Stringstatic public DAY_AS_TEXT:Stringstatic public HOUR_IN_AM_PM:Stringstatic public HOUR_IN_DAY:Stringstatic public MINUTE:Stringstatic public SECOND:Stringstatic public MILLISECOND:Stringstatic public QUOTE:Stringstatic public JANUARY:Stringstatic public FEBRUARY:Stringstatic public MARCH:Stringstatic public APRIL:Stringstatic public MAY:Stringstatic public JUNE:Stringstatic public JULY:Stringstatic public AUGUST:Stringstatic public SEPTEMBER:Stringstatic public OCTOBER:Stringstatic public NOVEMBER:Stringstatic public DECEMBER:Stringstatic public MONDAY:Stringstatic public TUESDAY:Stringstatic public WEDNESDAY:Stringstatic public THURSDAY:Stringstatic public FRIDAY:Stringstatic public SATURDAY:Stringstatic public SUNDAY:Stringpublic function format(date:Date):String
Formats the passed-in date with the specified date format pattern into a
date-time string and returns the resulting string.
If the passed-in date is null or undefined, the current
date-time will be used instead.
date | the date-time value to format into a date-time string |
the formatted date-time string