.getMinutes()
Anonymous contributor
Anonymous contributor3071 total contributions
Anonymous contributor
Published Jun 22, 2021Updated Jun 5, 2023
Contribute to Docs
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!
Codebyte Example
The example below defines a new Date
object dateTimeNow
, and stores the result of the getMinutes()
method in a new variable minutes
. Finally, the current date\time, minutes, and the minutes remaining in the hour are all logged to the console.
All contributors
- Anonymous contributorAnonymous contributor3071 total contributions
- EugeneGoh_51 total contributions
- Anonymous contributorAnonymous contributor5 total contributions
- christian.dinh2476 total contributions
- Anonymous contributor
- EugeneGoh_
- Anonymous contributor
- christian.dinh
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.