华拓科技网
您的当前位置:首页javascript当前日期加(天、周、月、年)_时间日期

javascript当前日期加(天、周、月、年)_时间日期

来源:华拓科技网


代码如下:
//create the date
var myDate = new Date();

//add a day to the date
myDate.setDate(myDate.getDate() + 1);

//add a week
myDate.setDate(myDate.getDate() + 7);

//add a month
myDate.setMonth(myDate.getMonth() + 1);

//add a year
myDate.setYear(myDate.getYear() + 1);

显示全文