setUTCMilliseconds 方法 (Date)
使用协调通用时间(UTC)Date对象中的毫秒值。
语法
dateObj.setUTCMilliseconds(numMilli)
参数
dateObj
必要参数。任何Date对象。
numMilli
必要参数。一个等于毫秒值的数值。
备注
若要使用当地时间设置毫秒值,请使用setMilliseconds方法。
如果numMilli的值大于999或为负,则所存储的秒数(以及分钟、小时等,如有必要)将增加适当的数量。
示例
下面的示例演示了setUTCMilliseconds方法的用法。
function SetUTCMSecDemo(nmsec){ // Create Date object. var d = new Date(); // Set UTC milliseconds. d.setUTCMilliseconds(nmsec); var s = "Current setting is "; s += d.toUTCString(); s += " and " + d.getUTCMilliseconds(); s += " milliseconds" return(s); }
必备条件
在以下文档模式中受支持:怪异模式、Internet Explorer 6标准模式、Internet Explorer 7标准模式、Internet Explorer 8标准模式、Internet Explorer 9标准模式、Internet Explorer 10标准模式、Internet Explorer 11标准模式。应用商店应用(Windows 8和Windows Phone 8.1)中也受支持。请参阅版本信息。
Applies To: Date Object