Home > Web Front-end > JS Tutorial > javascript current date plus (day, week, month, year)_time and date

javascript current date plus (day, week, month, year)_time and date

WBOY
Release: 2016-05-16 18:48:24
Original
1423 people have browsed it
复制代码 代码如下:

//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);
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template