function getStartDate(chooseYear){ // 按年度来计算的时候,开始时间是该年度7月1号还是到下一个年的6月30号结束 if(chooseYear == 2016){ return chooseYear + "-08-01"; }else{ return chooseYear+'-07-01'; } } //获取结束时间 function getEndDate(chooseYear){ chooseYear = parseInt(chooseYear); var endDate = new Date((chooseYear+1) + '-06-30'), now = new Date(); if(now <= endDate){ return now.format("yyyy-MM-dd"); }else{ return (chooseYear+1) + '-06-30'; } } /** * 获取多少天前的日期 */ function getDateBefore(days) { var now = new Date(); var date = new Date(now.getTime() - days * 24 * 3600 * 1000); var year = date.getFullYear(); var month = date.getMonth() + 1; var day = date.getDate(); var hour = date.getHours(); var minute = date.getMinutes(); var second = date.getSeconds(); return year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day); } /* * 获取用来排序的字段值,返回数组 * 参数: list - 列表, key - 字段的名称 */ function getKeyValueArr(list, key){ var arr = []; for(var k in list){ arr.push(list[k][key]); } return arr; } /* * 排名 */ function soreRank(arr){ var temp = []; var lis = []; for(var i=0;i