Date.prototype.setUTCMilliseconds()
Date 实例的 setUTCMilliseconds() 方法根据世界时间更改该日期的毫秒数。
¥The setUTCMilliseconds() method of Date instances changes the milliseconds for this date according to universal 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
如果你指定的参数超出预期范围,setUTCMilliseconds() 会尝试相应地更新 Date 对象中的日期信息。例如,如果对 millisecondsValue 使用 1100,则 Date 对象中存储的秒数将增加 1,毫秒将使用 100。
¥If a parameter you specify is outside of the expected range,
setUTCMilliseconds() attempts to update the date information in the
Date object accordingly. For example, if you use 1100 for
millisecondsValue, the seconds stored in the Date
object will be incremented by 1, and 100 will be used for milliseconds.
示例
使用 setUTCMilliseconds()
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-date.prototype.setutcmilliseconds |
浏览器兼容性
BCD tables only load in the browser