Date.prototype.getMilliseconds()

getMilliseconds() 方法根据本地时间,返回一个指定的日期对象的毫秒数。

尝试一下

语法

js
getMilliseconds()

参数

描述

getMilliseconds() 方法返回一个 0 到 999 的整数。

示例

示例:使用getMilliseconds方法

下例中,将当前时间的毫秒数赋值给变量 ms

js
var ms;
Today = new Date();
ms = Today.getMilliseconds();

规范

Specification
ECMAScript Language Specification
# sec-date.prototype.getmilliseconds

浏览器兼容性

BCD tables only load in the browser

参见