网络编程 
首页 > 网络编程 > 浏览文章

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

(编辑:jimmy 日期: 2026/8/26 浏览:3 次 )
复制代码 代码如下:
//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);
上一篇:Javascript+XMLHttpRequest+asp.net无刷新读取数据库数据
下一篇:javascript 局部页面打印实现代码