The Set methods are used for setting a part of a date formats.
The setFullYear() Method
setFullYear() sets a date object to a specific date. In this example, to April 27, 2016

<!DOCTYPE html>
<html>
<body>

<p>The setFullYear() method sets a date object to a special date.</p>

<p>Remember that JavaScript counts months from 0 to 11. Month 4 is April.</p>

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

<script>
var d = new Date();
d.setFullYear(2016, 3, 27);
document.getElementById("demo").innerHTML = d;
</script>

</body>
</html>

OUTPUT :


The setFullYear() method sets a date object to a special date.

Remember that JavaScript counts months from 0 to 11. Month 4 is April.


  • Prakash Singh

    keep it..