//获取当前日期，精确到日
function getEndTime() {
    var now = new Date();
    var sep = "-";
    var year = now.getFullYear();
    var month = now.getMonth() + 1;
    if (month < 10) {
        month = "0" + month;
    }
    var date = now.getDate();
    if (date < 10) {
        date = "0" + date;
    }
    //拼接当前的日期
    var endTime = year + sep + month + sep + date;
    return endTime;
}

//获取起始日期
function getStartTime(endTime) {
    var sep = "-";
    var arr = endTime.split("-");
    var year = arr[0];
    var month = "01";
    var date = "01";
    var startTime = year + sep + month + sep + date;
    return startTime;
}
//获取起始日期
function getMonthStartTime(endTime) {
    var sep = "-";
    var arr = endTime.split("-");
    var year = arr[0];
    var month = arr[1];
    var date = "01";
    var startTime = year + sep + month + sep + date;
    return startTime;
}
