function getPastHalfYear() {
// 先获取当前时间
var curDate = (new Date()).getTime();
// 将半年的时间单位换算成毫秒
var halfYear = 365 / 2 * 24 * 3600 * 1000;
var pastResult = curDate - halfYear; // 半年前的时间(毫秒单位)
// 日期函数,定义起点为半年前
var pastDate = new Date(pastResult),
pastYear = pastDate.getFullYear(),
pastMonth = pastDate.getMonth() + 1,
pastDay = pastDate.getDate();
return pastYear + '-' + pastMonth + '-' + pastDay;
}