0

I've got this basic code :

var currentDate:Date = new Date()
   var tommorow:Date = new Date()
   var day3:Date = new Date()
   var day4:Date = new Date()

currentDate.setDate(currentDate.getDate());
tommorow.setDate(tommorow.getDate()+1);
day3.setDate(day3.getDate()+2);
day4.setDate(day4.getDate()+3);

If I do :

trace(day4);

It returns : Tue Sep 1 18:16:12 GMT+1100 2015

How can I format this date in order to return this : "Tuesday 1 september 2015" ?

4

2 回答 2

1

使用DateTimeFormatter定义格式模式

var formatter:DateTimeFormatter = new DateTimeFormatter(LocaleID.DEFAULT);
formatter.setDateTimePattern("EEEE d MMMM yyyy");
trace(formatter.format(new Date())); // ex: "Saturday 29 August 2015"
于 2015-08-29T19:23:06.063 回答
-1

此代码有效。你可以复制这个:

var today:Date=new Date();
var months:Array=["Jan","Feb","Mar","Apr","May","Jun","jul","Aug","Sep","Oct",
"Nov","Dec"];
//you can change them to your desired texts !

var days:Array=["Sat","Sun","Mon","Tue","Wed","Thu","Fri"];

var display:String=days[today.day]+" "+today.date+" "+months[today.month]+" "+today.fullYear;
trace(display);

现在如果要显示三天后的日期,请修改today日期。

IH☻ PE 这有帮助。

于 2015-08-29T07:47:58.673 回答