Home >Web Front-end >JS Tutorial >JavaScript returns the minutes field of a time according to Universal Time (UTC) as returned by getUTCMinutes()

JavaScript returns the minutes field of a time according to Universal Time (UTC) as returned by getUTCMinutes()

黄舟
黄舟Original
2017-11-06 14:27:451200browse

Definition and Usage

The getUTCMinutes() method returns the minutes field of a time based on Universal Time (UTC).

Syntax

dateObject.getUTCMinutes()

Return value

Returns the minute field of dateObject expressed in universal time. The value is an integer between 0 and 59 .

Tips and Notes:

Note: The value returned by getUTCMinutes() is a two-digit number. However, the return value is not always two digits, if the value is less than 10, only one digit is returned.

Note: This method is always used in conjunction with a Date object.

Tip: For more information about Universal Coordinated Time (UTC), please refer to Baidu Encyclopedia.

Example

Example 1

In this example, we will get the UTC minutes of the current time:

<script type="text/javascript">

var d = new Date()
document.write(d.getUTCMinutes())

</script>

Output:

27

Example 2

Here we will extract UTC minutes from a specific date and time:

<script type="text/javascript">

var born = new Date("July 21, 1983 01:15:00")
document.write(born.getUTCMinutes())

</script>

Output:

15

The javascript Date.getUTCMinutes() method follows Universal time returns minutes on the specified date. The value returned by getUTCMinutes is an integer between 0 and 59.

Example:

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

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

This will produce the following results for India time zone:

getUTCMinutes() : 32


The above is the detailed content of JavaScript returns the minutes field of a time according to Universal Time (UTC) as returned by getUTCMinutes(). For more information, please follow other related articles on the PHP Chinese website!

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