参数说明:fromDate是"yyyy-MM-dd"的日期格式,为指定日期,例如‘2014-10-10’
dayInterval表示间隔天数,间隔天数大于0,则得到比指定日期大dayInterval天的日期,间隔天数小于0,则得到比指定日期小dayInterval天的日期
function getDateFromCurrentDate(fromDate,dayInterval){
var curDate = new Date(Date.parse(fromDate.replace(/-/g,"/")));curDate.setDate(curDate.getDate()+dayInterval);
var year = curDate.getFullYear();
var month = (curDate.getMonth()+1)<10?"0"+(curDate.getMonth()+1):(curDate.getMonth()+1);
var day = curDate.getDate()<10?"0"+curDate.getDate():curDate.getDate();
return year+"-"+month+"-"+day;
};