获取 系统近一年时间,前一个月、前三个月、近半年
let nowdate = new Date();
let y = nowdate.getFullYear();
let m = nowdate.getMonth() + 1;
let d = nowdate.getDate();
let formatnowdate = `${y}-${m}-${d}`;
//获取系统近一年的时间
nowdate.setYear(nowdate.getFullYear() - 1);
let y = nowdate.getFullYear();
let m = nowdate.getMonth() + 1;
let d = nowdate.getDate();
let formatwdate12 = `${y}-${m}-${d}`;
//获取系统前一个月的时间
nowdate.setYear(nowdate.getFullYear() + 1);
nowdate.setMonth(nowdate.getMonth() - 1);
let y = nowdate.getFullYear();
let m = nowdate.getMonth() + 1;
let d = nowdate.getDate();
let formatwdate = `${y}-${m}-${d}`;
//获取系统前三个月的时间
nowdate.setMonth(nowdate.getMonth() - 2);
let y = nowdate.getFullYear();
let m = nowdate.getMonth() + 1;
let d = nowdate.getDate();
let formatwdate3 = `${y}-${m}-${d}`;
//获取系统近半年的时间
nowdate.setMonth(nowdate.getMonth() - 3);
let y = nowdate.getFullYear();
let m = nowdate.getMonth() + 1;
let d = nowdate.getDate();
let formatwdate6 = `${y}-${m}-${d}`;