Set the day of the month to be the last day of the previous month: setUTCDate(0) - Javascript Date

Javascript examples for Date:setUTCDate

Description

Set the day of the month to be the last day of the previous month: setUTCDate(0)

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from   w w w .j  a  v  a2 s .co m*/
    var d = new Date();
    d.setUTCDate(0);
    document.getElementById("demo").innerHTML = d;
}
</script>

</body>
</html>

Related Tutorials