在AS3中更改日期格式

时间:2015-08-29 07:19:27

标签: actionscript-3 date formatdatetime

我已经获得了这个基本代码:

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

如果我这样做:

trace(day4);

返回:Tue Sep 1 18:16:12 GMT+1100 2015

如何格式化此日期以便返回此日期:"Tuesday 1 september 2015"

2 个答案:

答案 0 :(得分:1)

DateTimeFormattercustom format pattern

一起使用
$artist = 'Led Zeppelin';
$title = 'Kashmir';

$spotifyURL = 'https://api.spotify.com/v1/search?q='.$artist.'%20'.$title.'&type=track';

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $spotifyURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:x.x.x) Gecko/20041107 Firefox/x.x");
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$json = curl_exec($ch);
$json = json_decode($json);
curl_close($ch);

echo '<pre>'.print_r($json, true).'</pre>';

答案 1 :(得分:-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日期。

我这是有帮助的。