Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript getMinutes() Method

JavaScript getMinutes() Method

Date Object Reference JavaScript Date object

Example

Return the minutes of a time based on local time:

var d = new Date();

var n = d.getMinutes();

n Output result:

Try it »


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 in 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 set date and time:

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

var n = d.getMinutes();

n Output result:

15

Try it »

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


Date Object Reference JavaScript Date object