Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to add a number of months to a date using JavaScript?
To add a number of months to a date, first get the month using getMonth() method and add a number of months.
Example
You can try to run the following code to add a number of months
<!DOCTYPE html>
<html>
<body>
<script>
var d, e;
d = new Date();
document.write(d);
e = d.getMonth()+1;
document.write("<br>Incremented month = "+e);
</script>
</body>
</html>Advertisements