Flex 获取每月第几周小例子

页面导航:首页 > 网络编程 > Flex > Flex 获取每月第几周小例子

Flex 获取每月第几周小例子

来源:互联网 作者:脚本宝典 时间:2015-06-23 18:50 【

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 ); //本
<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>
Tags:

相关文章

    文章评论

    最 近 更 新
    热 点 排 行
    Js与CSS工具
    代码转换工具
    
    <