JavaScript Date getMonth()

The JavaScript date getMonth() method is used to get the integer value between 0 and 11 that represents the month based on the local time.

Syntax:

dateObj.getMonth()

Return: An integer value between 0 and 11.

Example:

<!DOCTYPE html>
<html>
<body>
<script>
var d = new Date("March 16, 2018 13:34:45:500");
var n = d.getMonth()+1;
document.writeln(n)
</script>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com