JavaScript setUTCMinutes

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

 Date.setUTCMinutes(Minutes, Seconds, Milliseconds)

In this set UTC Minutes 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> JS </title>
</head>
<body>
    <h1> Example </h1>
<script>
  var dt = Date();  
  document.write("Date and Time : " + dt + "<br/>");

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

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

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

<!DOCTYPE html>
<html>
<head>
    <title> JavaScriptSet UTC Minutes Functions </title>
</head>
<body>
    <h1> JavaScriptsetUTCMinutesFunctionExample </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>
setUTCMinutes Example

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

<!DOCTYPE html>
<html>
<head>
    <title> JS </title>
</head>
<body>
    <h1> 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 : " + dt);
</script>
</body>
</html>
Example

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