Javascript Data Type How to - Get date of month for the next day








Question

We would like to know how to get date of month for the next day.

Answer


<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
window.onload=function(){<!-- w w  w.j av  a  2  s .  co m-->
    var today = new Date();
    var tomorrow = new Date();
    tomorrow.setDate(today.getDate()+1);
    document.writeln(tomorrow.getDate());    
}
</script>
</head>
<body>
</body>
</html>

The code above is rendered as follows: