.getMinutes()

Called from an instance of the Date class, will return the minutes according to the local time.

Syntax

myDate.getMinutes();

The return value of getMinutes() will only be an integer number between 0 and 59, meaning the minutes according to the local time.

Example

To determine if it has been 15 minutes:

const today = new Date('June 25, 2021 13:15:00');
if (today.getMinutes() >= 15) {
console.log('Hurry up, it has been 15 minutes!');
} else {
console.log('Take your time, we still have time for it.');
}
// Output: Hurry up, it has been 15 minutes!
Edit this page on GitHub

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your feedback.

Learn JavaScript on Codecademy

Edit this page on GitHub

Contributors