<prename="code"class="html">privatefunctioncalcWeekTotal(showDate:Date):Array{
showDate=DateFormatter.parseDateString("2013-04-01");
//获取本月1好的日期
varoneDate:Date=newDate(showDate.fullYear,showDate.month,1);
//本月第一周星期一的日期
varoneWeekDate:int=7-oneDate.day+2;
//本月共几天
vartotalDay:int=newDate(showDate.fullYear,showDate.month,0).date;
vartotalWeek:int=(totalDay-oneWeekDate+1)%7==0?
(totalDay-oneWeekDate+1)/7:(totalDay-oneWeekDate+1)/7+1;
trace(totalWeek);
//当前日期在本月第几周
varcurrentWeek:int=newint((showDate.date-oneWeekDate)/7)+1;
if(currentWeek==0){
//上个月最后一周
}
vararr:Array=newArray();
arr[0]=totalWeek;
arr[1]=currentWeek;
returnarr;
}</pre><br>
<br>
<pre></pre>