Skip to content

Add a number of months to a date in JavaScript

Find out how to add months to a date in JavaScript. To add a number of months to a date, first get the month using getMonth() method and add a number of months.

var date = new Date();
console.log(date.getMonth()+1);
See also  Max Min - Hackerrank Challenge - Java Solution

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.