getMinutes()
Returns the date's minutes as a number between 0 and 59.
getMinutes() |
Yes | Yes | Yes | Yes | Yes |
dateObject.getMinutes();
None
return a number from 0 to 59 representing minutes.
var myDate = new Date();
console.log(myDate.getMinutes());
The code above generates the following result.
The following code return the minutes from a specific date and time:
<!DOCTYPE html>
<html>
<body>
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {<!-- ww w . j a v a 2 s.co m-->
var d = new Date("July 12, 1987 01:15:00");
var n = d.getMinutes();
document.getElementById("demo").innerHTML = n;
}
</script>
</body>
</html>
The code above is rendered as follows: