function getStartDate(){ // 先获取当前时间 var curDate = (new Date()).getTime(); // 获取六个季度以前的数据 var passfYear =(365 / 4)*6 * 24 * 3600 * 1000; var pastResult = curDate - passfYear; // 半年前的时间(毫秒单位) var pastDate = new Date(pastResult); pastYear = pastDate.getFullYear(); pastMonth = pastDate.getMonth() + 1; var passq = parseInt(pastMonth / 3); //当前季度 return pastYear+"0"+passq; }