Home >>JavaScript Date Object Methods >JavaScript setUTCMinutes() Method
JavaScript setUTCMinutes() method is used to set the minutes of a given input date object according to the universal time (UTC) that is the time set by the World Time Standard.
Syntax:Date.setUTCMinutes(min, sec, millisec)
Parameter | Description |
---|---|
min | This is a required parameter. It defines an integer representing the minutes. |
sec | This is an optional parameter. It defines an integer representing the seconds. |
millisec | This is an optional parameter. It defines an integer representing the milliseconds. |
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
setUTCMinutes() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <p>Click the button to see the Output.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { var d = new Date(); d.setUTCMinutes(25); document.getElementById("demo").innerHTML = d; } </script> </body> </html>
Click the button to see the Output.
<html> <body> <p>Click the button to see the Output.</p> <button onclick="myFunction1()">Try it</button> <p id="demo1"></p> <script> function myFunction1() { var d = new Date(); d.setUTCMinutes(d.getUTCMinutes() - 60); document.getElementById("demo1").innerHTML = d; } </script> </body> </html>
Click the button to see the Output.