码迷,mamicode.com
首页 > 其他好文 > 详细

this week,last week,this month,last month

时间:2014-09-22 18:19:12      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   ar   div   sp   cti   on   

var registerDateRange = (function(option){
            var dateRange = {};
            var sysDate = new Date();
            switch(option) {
            case ‘0‘ :
                break;
            case ‘1‘ : 
                sysDate.setDate(sysDate.getDate() - (sysDate.getDay() - 1));
                dateRange.from = sysDate;
                break;
            case ‘2‘ : 
                sysDate.setDate(sysDate.getDate() - (sysDate.getDay() + 6));
                dateRange.from = sysDate;
                
                var toDate = new Date();
                toDate.setDate(sysDate.getDate() + 6);
                dateRange.to = toDate;
                break;
            case ‘3‘ :
                sysDate.setDate(sysDate.getDate() - (sysDate.getDate() - 1));
                dateRange.from = sysDate;
                break;
            case ‘4‘ :
                sysDate.setDate(sysDate.getDate() - sysDate.getDate());
                dateRange.to = sysDate;
                
                var fromDate = new Date(sysDate);
                fromDate.setDate(fromDate.getDate() - (fromDate.getDate() - 1) );
                dateRange.from = fromDate;
                break;
            }
            return dateRange;
        })($("#registerDate").val());

 

this week,last week,this month,last month

标签:style   blog   color   io   ar   div   sp   cti   on   

原文地址:http://www.cnblogs.com/shouwangzhe-/p/3986119.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!