Encodera

Thanks for reading!

Donate to the site — we work hard for you.

JavaScript reference

Date.prototype.getMinutes

Returns the minutes.

Available since: ES1

Syntax

date.getMinutes()

Return value

numberThe minutes from 0 to 59.

Examples

Time in HH:MM format:

const date = new Date(2026, 2, 15, 9, 5);
const hh = String(date.getHours()).padStart(2, '0');
const mm = String(date.getMinutes()).padStart(2, '0');
 
console.log(`${hh}:${mm}`);

Output:

09:05

Notes

Minutes below 10 come as one digit, so they are padded with a zero using padStart().

See also

In the tutorial

  • Dates and time — The Date object in JavaScript: creating a date, reading the year, month and day, changing a date, the difference between dates and the ISO format.

Thanks for reading!

Donate to the site — we work hard for you.