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);
posted @ 2009-08-07 11:28  代码乱了  阅读(881)  评论(0编辑  收藏  举报