Home >>JavaScript Date Object Methods >JavaScript getMinutes() Method

JavaScript getMinutes() Method

JavaScript getMinutes() Method

JavaScript getMinutes() method is used to return the minutes of the given input date and time. It returns an integer value between 0 to 59.

Syntax:
Date.getMinutes()

Browser Support

Method Chrome Edge Firefox Safari Opera
getMinutes() Yes Yes Yes Yes Yes
Here is an example of JavaScript getMinutes method:
<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();
  var n = d.getMinutes();
  document.getElementById("demo").innerHTML = n;
}
</script>
</body>
</html>
Output:

Click the button to see the Output.

Example 2:
<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("May 27, 1967 21:25:00");
  var n = d.getMinutes();
  document.getElementById("demo1").innerHTML = n;
}
</script>
</body>
</html>
Output:

Click the button to see the Output.


No Sidebar ads