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
Release: 2016-05-16 15:55:58
Original
1176 people have browsed it

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()
Copy after login

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>
Copy after login

This will produce the following results:

getUTCMonth() : 7 
Copy after login

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template