SoFunction
Updated on 2025-03-06

Use of getMonth method of operating time in JavaScript

The getMonth() method of the javascript date returns the month on the specified date according to the local time. The value returned by obtaining the month is 0-11; 0 corresponds to January, 1 corresponds to February, etc.
grammar

()

The following are the detailed information of the parameters:

  •     NA

Return value:

Returns the month of the specified date according to local time
example:

<html>
<head>
<title>JavaScript getMonth Method</title>
</head>
<body>
<script type="text/javascript">
  var dt = new Date( "December 25, 1995 23:15:00" );
  ("getMonth() : " + () ); 
</script>
</body>
</html>

This will produce the following results:

getMonth() : 11