JavaScript: date.setUTCMinutes() Method with Example

JavaScript date.setUTCMinutes() method; Through this tutorial, i am going to show you how to sets utc minutes with seconds and milliseconds using the javaScript setUTCMinutes() method with the help of examples.

JavaScript: setUTCMinutes() Method

The setUTCMinutes() is an inbuild javascript method, which is used to sets the minute of a date object, according to the universal time (UTC).

Note: This method accepts three-parameter values. The first one is required and the remaining parameters are optional in this function.

Syntax of JavaScript: setUTCMinutes() Method

Date.setUTCMinutes(min, sec, millisec);

Parameter of JavaScript: setUTCMinutes() Method

ParameterDescription
minThis is a first parameter and required. You can pass values integer value from 0-59 in this parameter
secThis is a second parameter and optional. You can pass values integer value from 0-59 in this parameter
millisecThis is a third parameter and optional. You can pass values integer value from 0-999 in this parameter

Example 1 – JavaScript: setUTCMinutes() Method

Let’s see the following example using setUTCMinutes method; as shown below:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>javascript date set utc minutes</title>
</head>
<body>
  <script type = "text/javascript">
     var date = new Date();
     date.setUTCMinutes(12);
     document.write( "javascript date set utc minutes using setUTCMinutes() : " + date );
  </script>  
</body>
</html>

Output of the above code is:

javascript date set utc minutes

Example 2 – JavaScript: setUTCMinutes() Method

See the second example using setUTCMinutes method with minutes and seconds; as shown below:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>javascript date set utc minutes with seconds</title>
</head>
<body>
  <script type = "text/javascript">
     var date = new Date();
     date.setUTCMinutes(12, 16);
     document.write( "javascript date set utc minutes with seconds using setUTCMinutes() : " + date );
  </script>  
</body>
</html>

Output of the above code is:

javascript date set utc minutes with seconds

Example 3 – JavaScript: setUTCMinutes() Method

See the third example using setUTCMinutes method with minutes and seconds and milliseconds; as shown below:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>javascript date set utc minutes with seconds and milliseconds</title>
</head>
<body>
  <script type = "text/javascript">
     var date = new Date();
     date.setUTCMinutes(12, 16, 50);
     document.write( "javascript date set utc minutes with seconds and milliseconds using setUTCMinutes() : " + date );
  </script>  
</body>
</html>

Output of the above code is:

javascript date set utc minutes with seconds and milliseconds

Conclusion

In this javascript tutorial, you have learned how to sets a minute with seconds, milliseconds parameters using setUTCMinutes method with an example.

Recommended JavaScript Tutorials

Leave a Comment