Date.prototype.setMilliseconds()
Date 实例的 setMilliseconds() 方法根据当地时间更改该日期的毫秒数。
¥The setMilliseconds() method of Date instances changes the milliseconds for this date according to local time.
Try it
语法
参数
返回值
¥Return value
就地更改 Date 对象,并返回其新的 timestamp。如果 millisecondsValue 是 NaN(或获取 coerced 到 NaN 的其他值,例如 undefined),则日期设置为 失效日期 并返回 NaN。
¥Changes the Date object in place, and returns its new timestamp. If millisecondsValue is NaN (or other values that get coerced to NaN, such as undefined), the date is set to Invalid Date and NaN is returned.
描述
¥Description
如果你指定的数字超出预期范围,则 Date 对象中的日期信息将相应更新。例如,如果指定 1005,则秒数增加 1,并且使用 5 表示毫秒。
¥If you specify a number outside the expected range, the date information in the Date object is updated accordingly. For example, if you specify 1005, the number of seconds is incremented by 1, and 5 is used for the milliseconds.
示例
使用 setMilliseconds()
规范
| Specification | 
|---|
| ECMAScript Language Specification  # sec-date.prototype.setmilliseconds  | 
浏览器兼容性
BCD tables only load in the browser