JavaScript getMinutes()Method

Date 对象参考手册JavaScript Date Object

Example

Return the minutes of the time based on local time:

var d = new Date();
var n = d.getMinutes();

nOutput:


Try it yourself »

Definition and Usage

The getMinutes() method returns the minutes field of a time.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the getMinutes() method


Syntax

Date.getMinutes()

Return Value

Type Description
Number The minutes field of the date Object, displayed according to local time. The return value is an integer between 0 and 59.

Technical Details

JavaScript Version: 1.0


More Examples

Example

Return the minutes of a specified date and time:

var d = new Date("July 21, 1983 01:15:00");
var n = d.getMinutes();

nOutput:

15

Try it yourself »
实例s

Display the current time
How to use getHours(), getMinutes(), and getSeconds() to display the current time.


Date 对象参考手册JavaScript Date Object

Other Extensions