站长网 Unix Flex 获取每月第几周小例子

Flex 获取每月第几周小例子

preprivate 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

<pre>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>

本文来自网络,不代表站长网立场,转载请注明出处:https://www.zwzz.com.cn/html/server/unix/2021/0523/4213.html

作者: dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。
联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部