JavaScript Date getMinutes() Method
- Previous Page getMilliseconds()
- Next Page getMonth()
- Go Back to the Previous Level JavaScript Date Reference Manual
Definition and Usage
getMinutes()
The method returns the number of minutes for a specified date and time (from 0 to 59).
Example
Example 1
Return minutes according to local time:
var d = new Date(); var n = d.getMinutes();
Example 2
Return the number of minutes for a specific date and time:
var d = new Date("July 21, 1983 01:15:00"); var n = d.getMinutes();
Example 3
Display time using getHours(), getMinutes(), and getSeconds():
function addZero(i) { if (i < 10) { i = "0" + i; } return i; } function myFunction() { var d = new Date(); var x = document.getElementById("demo"); var h = addZero(d.getHours()); var m = addZero(d.getMinutes()); var s = addZero(d.getSeconds()); x.innerHTML = h + ":" + m + ":" + s; }
Syntax
Date.getMinutes()
Parameters
No parameters.
Technical Details
Return Value: | Numbers, from 0 to 59, represent minutes. |
---|---|
JavaScript Version: | ECMAScript 1 |
Browser Support
Method | Chrome | IE | Firefox | Safari | Opera |
---|---|---|---|---|---|
getMinutes() | Support | Support | Support | Support | Support |
Related Pages
Tutorial:JavaScript Date
Tutorial:JavaScript Date Format
Tutorial:JavaScript Object Constructor
- Previous Page getMilliseconds()
- Next Page getMonth()
- Go Back to the Previous Level JavaScript Date Reference Manual