Date.prototype.getMinutes()
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
getMinutes()
方法根据本地时间,返回一个指定的日期对象的分钟数。
尝试一下
const birthday = new Date("March 13, 08 04:20");
console.log(birthday.getMinutes());
// Expected output: 20
语法
js
getMinutes()
参数
无
描述
getMinutes
返回一个 0 到 59 的整数值。
示例
示例:使用getMinutes
方法
下例中,第二行语句运行过后,变量 minutes
的值为 15,也就是说 Xmas95
这个日期对象的值为某时 15 分某秒。
js
var Xmas95 = new Date("December 25, 1995 23:15:00");
var minutes = Xmas95.getMinutes();
规范
Specification |
---|
ECMAScript® 2025 Language Specification # sec-date.prototype.getminutes |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
getMinutes |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.