diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html new file mode 100644 index 0000000000..b3059be4cb --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/date/setutcmilliseconds/index.html @@ -0,0 +1,84 @@ +--- +title: Date.prototype.setUTCMilliseconds() +slug: Web/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds +translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds +--- +<div>{{JSRef}}</div> + +<p><strong><code>setUTCMilliseconds()</code></strong> 方法会根据世界时来设置指定时间的毫秒数。</p> + +<div>{{EmbedInteractiveExample("pages/js/date-setutcmilliseconds.html")}}</div> + + + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox"><code><var>dateObj</var>.setUTCMilliseconds(<var>millisecondsValue</var>)</code></pre> + +<h3 id="参数">参数</h3> + +<dl> + <dt><code>millisecondsValue</code></dt> + <dd>0 - 999 之间的数值,代表毫秒数。</dd> +</dl> + +<h3 id="返回值">返回值</h3> + +<p>返回更新后的时间距 1970 年 1 月 1 日 00:00:00 (UTC) 的毫秒数。</p> + +<h2 id="描述">描述</h2> + +<p>如果传递的参数超出了指定的范围,<code>setUTCMilliseconds() 方法会相应地尝试更新储存在 </code>{{jsxref("Date")}} 的时间信息。例如,假设你传递参数的值是 1100,存储在 {{jsxref("Date")}} 的秒数会加 1,然后使用 100 来作为毫秒数。</p> + +<h2 id="示例">示例</h2> + +<h3 id="使用_setUTCMilliseconds()_方法">使用 <code>setUTCMilliseconds() 方法</code></h3> + +<pre class="brush: js">var theBigDay = new Date(); +theBigDay.setUTCMilliseconds(500); +</pre> + +<h2 id="规范">规范</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">规范版本</th> + <th scope="col">规范状态</th> + <th scope="col">注解</th> + </tr> + <tr> + <td>{{SpecName('ES1')}}</td> + <td>{{Spec2('ES1')}}</td> + <td>初始定义。于 JavaScript 1.3 实现。</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.9.5.29', 'Date.prototype.setUTCMilliseconds')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-date.prototype.setutcmilliseconds', 'Date.prototype.setUTCMilliseconds')}}</td> + <td>{{Spec2('ES6')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ESDraft', '#sec-date.prototype.setutcmilliseconds', 'Date.prototype.setUTCMilliseconds')}}</td> + <td>{{Spec2('ESDraft')}}</td> + <td> </td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("javascript.builtins.Date.setUTCMilliseconds")}}</p> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li>{{jsxref("Date.prototype.getUTCMilliseconds()")}}</li> + <li>{{jsxref("Date.prototype.setMilliseconds()")}}</li> +</ul> |