CodesJava

Easy learning with example program codes

JavaScript setMonth() method

The JavaScript date setMonth() method sets the month value for the particular date on the basis of local time.

Syntax:

dateObj.setMonth(new_Month);

Parameters:
new_Month: Integer value between 0 to 11.

Example:

<!DOCTYPE html>
<html>
<body>
<script>   	 
var bday =new Date("November 16, 1994 21:00:10");
document.writeln(bday.getMonth() + "<br>");  
bday.setMonth(11);  
document.writeln(bday.getMonth());  
</script>  
</body>
</html>

Output:

10
11
Please follow and like us:
error








Copyright © 2019 CodesJava DMCA.com Protection Status