JavaScript setUTCMinutes

JavaScript setUTCMinutes function is used to set Minutes, Seconds, and Milliseconds of a specified date as per the universal time. The syntax of the setUTCMinutes Date function is:

 Date.setUTCMinutes(Minutes, Seconds, Milliseconds)

In this setUTCMinutes method, Seconds and Milliseconds are optional arguments.

JavaScript setUTCMinutes Function Example

Here, we are using the setUTCMinutes function to set the current date minutes to 75 as per the universal time.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Set UTC Minutes Functions </title>
</head>
<body>
    <h1> JavaScript setUTCMinutes Function Example </h1>
<script>
  var dt = Date();  
  document.write("Date and Time : " + dt + "<br/>");

  dt.setUTCMinutes(75);
  document.write("After setUTCMinutes() : " + dt);
</script>
</body>
</html>
JavaScript setUTCMinutes Example

Date and Time: Thu Nov 08 2018 12:24:31 GMT+0530 (Indian Standard Time)
After setUTCMinutes(): Thu Nov 08 2018 12:45:31 GMT+0530 (Indian Standard Time)

set UTC Minutes Function Example 2

In this setUTCMinutes example, we set the custom date minutes to 250, and seconds to 45 according to universal time.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Set UTC Minutes Functions </title>
</head>
<body>
    <h1> JavaScript setUTCMinutes Function Example </h1>
<script>
  var dt = Date("May 1, 2016 10:11:19");
  document.write("Date and Time : " + dt + "<br/>");

  dt.setUTCMinutes(250, 45);
  document.write("After setUTCMinutes() : " + dt);
</script>
</body>
</html>
JavaScript setUTCMinutes Function 2

In this JavaScript example, we set the Minutes to 250, seconds to 45, and milliseconds to 5000000

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript Set UTC Minutes Functions </title>
</head>
<body>
    <h1> JavaScript setUTCMinutes Function Example </h1>
<script>
  var dt = Date("May 1, 2016 10:11:19");
  document.write("Date and Time : " + dt + "<br/>");

  dt.setUTCMinutes(250, 45, 5000000);
  document.write("After setUTCMinutes() : " + dt);
</script>
</body>
</html>
JavaScript setUTCMinutes Example

Date and Time: Sun May 01 2016 10:11:19 GMT+0530 (Indian Standard Time)
After setUTCMinutes(): Sun May 01 2016 15:94:05 GMT+0530 (Indian Standard Time)