Javascript Data Type How to - Add one more month to current date








Question

We would like to know how to add one more month to current date.

Answer


<!DOCTYPE html>
<html>
<body>
<script type='text/javascript'>
<!--from w w  w.  j a  v a  2  s.c om-->
    var x = new Date();
    x.setMonth(x.getMonth() + 1);
    document.writeln(x);

</script>
</body>
</html>

The code above is rendered as follows: