// 半年,1年,3年前后的时间获取exportfunctiongetRequiresTime(time, type =null, number =0){var nowdate =newDate(time);switch(type){case"day"://取number天前、后的时间
nowdate.setTime(nowdate.getTime()+(24*3600*1000)* number);var y = nowdate.getFullYear();var m = nowdate.getMonth()+1;var d = nowdate.getDate();var retrundate = y +'-'+(m >=10? m :'0'+ m)+'-'+(d >=10? d :'0'+ d);break;case"week"://取number周前、后的时间var weekdate =newDate(nowdate +(7*24*3600*1000)* number);var y = weekdate.getFullYear();var m = weekdate.getMonth()+1;var d = weekdate.getDate();var retrundate = y +'-'+(m >=10? m :'0'+ m)+'-'+(d >=10? d :'0'+ d);break;case"month"://取number月前、后的时间
nowdate.setMonth(nowdate.getMonth()+ number);var y = nowdate.getFullYear();var m = nowdate.getMonth()+1;var d = nowdate.getDate();var retrundate = y +'-'+(m >=10? m :'0'+ m)+'-'+(d >=10? d :'0'+ d);break;case"year"://取number年前、后的时间
nowdate.setFullYear(nowdate.getFullYear()+ number);var y = nowdate.getFullYear();var m = nowdate.getMonth()+1;var d = nowdate.getDate();var retrundate = y +'-'+(m >=10? m :'0'+ m)+'-'+(d >=10? d :'0'+ d);break;default://取当前时间var y = nowdate.getFullYear();var m = nowdate.getMonth()+1;var d = nowdate.getDate();var retrundate = y +'-'+(m >=10? m :'0'+ m)+'-'+(d >=10? d :'0'+ d);}return retrundate;}