zoukankan      html  css  js  c++  java
  • this week,last week,this month,last month

    var registerDateRange = (function(option){
                var dateRange = {};
                var sysDate = new Date();
                switch(option) {
                case '0' : // all
                    break;
                case '1' :  // this week
                    sysDate.setDate(sysDate.getDate() - (sysDate.getDay() - 1));
                    dateRange.from = sysDate;
                    dateRange.to = new Date();
                    break;
                case '2' :  // last week
                    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' : // this month
                    sysDate.setDate(sysDate.getDate() - (sysDate.getDate() - 1));
                    dateRange.from = sysDate;
                    dateRange.to = new Date();
                    break;
                case '4' : // last month
                    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());
  • 相关阅读:
    ColorMask
    InfoPanel
    什么是三消游戏
    Display file information in the document window
    Layer Comps
    Add words to your picture
    为什么质数是无穷的?
    嘉年华的来历
    MonoBehaviour.OnValidate
    Loadrunner中百分比模式和Vuser模式
  • 原文地址:https://www.cnblogs.com/shouwangzhe-/p/3986119.html
Copyright © 2011-2022 走看看