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  Merge k Sorted Lists - Leetcode Challenge - Python Solution

Leave a Reply

Your email address will not be published. Required fields are marked *

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