首页 > 其他 > 详细

this week,last week,this month,last month

时间:2014-09-22 16:37:03      阅读:292      评论:0      收藏:0      [点我收藏+]
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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!