• 获取当前季的js


    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <script type="text/javascript">
    //获得本季度的开始月份 
    function getQuarterStartMonth() {
    var quarterStartMonth = "";
    var now = new Date();
    var nowMonth = now.getMonth();
    var nowYear = now.getFullYear(); //当前年
    
    if (nowMonth < 3) {
    quarterStartMonth = nowYear + '-' + '01-01';
    }
    if (2 < nowMonth && nowMonth < 6) {
    quarterStartMonth = nowYear + '-' + '04-01';
    }
    if (5 < nowMonth && nowMonth < 9) {
    quarterStartMonth = nowYear + '-' + '07-01';
    }
    if (nowMonth > 8) {
    quarterStartMonth = nowYear + '-' + '10-01';
    }
    // alert("这是季起始日期"+getQuarterEndMonth(quarterStartMonth));// 起始日期
    alert("这是季结束日期"+quarterStartMonth); //结束日期
    
    }
    
    
    // function getQuarterEndMonth(str_dt) {
    // //var str_dt = '2011-12-16';
    // var day = str_dt.substring(str_dt.lastIndexOf('-') + 1); //获取源数据的天数值,这里是31
    
    // var dt = new Date(str_dt);
    // var result = [];
    
    // dt.setMonth(dt.getMonth() - 15); //这边是减5季 ,因为每季3个月。所以是15个月
    
    // result.push(dt.getFullYear());
    
    // //计算结果日期值<源数据日期值时,说明日期值超过当月最大天数,日期值修改为当月最大天数值
    // if (dt.getDate() < day) {
    // result.push(dt.getMonth());
    // dt.setDate(0);
    // }
    // else result.push(dt.getMonth() + 1);
    // result.push(dt.getDate());
    // return result.join('-');
    // }
    </script>
    </head>
    <body>
    <div>
    <input type="button" onclick="getQuarterStartMonth()" />
    </div>
    </body>
    </html>
    

      

  • 相关阅读:
    HTML新解
    关于EF4.1更新数据后的显示问题PagedList
    SQL2008中的XML字段操作,与命名空间相关
    64位Win7+iis7下发布MVC3 web项目
    蓝屏、异常关机操成的 未能加载文件或程序集“....”或它的某一个依赖项。参数错误。
    FreeWriting_12
    FreeWriting_13
    【转】ACE的构建(VC++6.0环境)
    Freewriting_10
    FreeWriting_16
  • 原文地址:https://www.cnblogs.com/wdw31210/p/2557707.html
Copyright © 2020-2023  润新知