increment some days in date object using JavaScript

 

Use the following JavaScript built-in methods to add five days in date object getDate() method to get the day of the month from the particular date object while the setdate() method is used to update the date object and set specific date. This method takes day of month as an input.

the following code will add 5(five) days in the the date object

 

var dateObj = new Date();
dateObj.setDate(dateObj.getDate() + 5);
console.log(dateObj);

Tags:

Share:

Related posts