内容简介:本节主要介绍了Flex如何获取每月第几周,需要的朋友可以参考下
<pre name="code" class="html">private function calcWeekTotal(showDate:Date):Array{
showDate = DateFormatter.parseDateString("2013-04-01");
//获取本月1好的日期
var oneDate:Date = new Date(showDate.fullYear,showDate.month,1);
//本月第一周星期一的日期
var oneWeekDate:int = 7 - oneDate.day + 2;
//本月共几天
var totalDay :int= new Date(showDate.fullYear,showDate.month,0).date;
var totalWeek:int = (totalDay - oneWeekDate + 1) % 7 == 0 ?
(totalDay - oneWeekDate + 1) /7:(totalDay - oneWeekDate + 1) /7 + 1;
trace(totalWeek);
//当前日期在本月第几周
var currentWeek:int = new int((showDate.date - oneWeekDate)/7) + 1;
if(currentWeek == 0){
//上个月最后一周
}
var arr:Array = new Array();
arr[0] = totalWeek;
arr[1] = currentWeek;
return arr;
}</pre><br>
<br>
<pre></pre>
以上所述就是小编给大家介绍的《Flex 获取每月第几周小例子》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
How to Solve It
Zbigniew Michalewicz、David B. Fogel / Springer / 2004-03-01 / USD 59.95
This book is the only source that provides comprehensive, current, and detailed information on problem solving using modern heuristics. It covers classic methods of optimization, including dynamic pro......一起来看看 《How to Solve It》 这本书的介绍吧!