Home >Web Front-end >JS Tutorial >Introduction to the use of getUTCMonth() method in JavaScript_Basic knowledge

Introduction to the use of getUTCMonth() method in JavaScript_Basic knowledge

WBOY
WBOYOriginal
2016-05-16 15:55:581198browse

The javascript Date.getUTCMonth() method returns the month on the specified date according to universal time. The value returned by getUTCMonth is an integer between 0 and 11 corresponding to the month. 0 represents January, 1 represents February, 2 represents March, and so on.
Grammar

Date.getUTCMonth()

Here are the details of the parameters:

  • NA

Return value:

Returns the month of the specified date according to universal time.
Example:

The following example prints the month part of the current time variable hrs.

<html>
<head>
<title>JavaScript getUTCMonth Method</title>
</head>
<body>
<script type="text/javascript">
  var dt = new Date();
  document.write("getUTCMonth() : " + dt.getUTCMonth() ); 
</script>
</body>
</html>

This will produce the following results:

getUTCMonth() : 7 

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn