aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/date/setutcseconds
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/javascript/reference/global_objects/date/setutcseconds
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-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/setutcseconds')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/date/setutcseconds/index.html92
1 files changed, 92 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/setutcseconds/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/setutcseconds/index.html
new file mode 100644
index 0000000000..fce240e115
--- /dev/null
+++ b/files/zh-cn/web/javascript/reference/global_objects/date/setutcseconds/index.html
@@ -0,0 +1,92 @@
+---
+title: Date.prototype.setUTCSeconds()
+slug: Web/JavaScript/Reference/Global_Objects/Date/setUTCSeconds
+tags:
+ - 日期
+translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCSeconds
+---
+<div>{{JSRef}}</div>
+
+<p><code><font face="Open Sans, Arial, sans-serif">此 </font><strong>setUTCSeconds()</strong></code> 方法为一个依据国际通用时间的特定日期设置秒数。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/date-setutcseconds.html")}}</div>
+
+
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><code><var>dateObj</var>.setUTCSeconds(<var>secondsValue</var>[, <var>msValue</var>])</code></pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>secondsValue</code></dt>
+ <dd>一个在0到59之间的整数,表示秒数。</dd>
+ <dt><code>msValue</code></dt>
+ <dd>可选参数。一个0到999之间的数字,代表毫秒数。</dd>
+</dl>
+
+<h3 id="返回值">返回值</h3>
+
+<p>一个毫秒数,表示从国际通用时间1970年00:00:00到设置的时间值之间的时间跨度。</p>
+
+<h2 id="描述">描述</h2>
+
+<p>如果你没有设置msValue参数的值, 那么返回的值来自{{jsxref("Date.prototype.getUTCMilliseconds()", "getUTCMilliseconds()")}} 方法。</p>
+
+<p>如果你指定的值超出了范围, <code>setUTCSeconds()</code> 因此会更新{{jsxref("Date")}} 对象中date的相关信息 . 举个例子, 如果你设置secondsValue为100, {{jsxref("Date")}} 对象中的分钟数会增加1, 并且秒数会变成40.</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="使用_setUTCSeconds()">使用 <code>setUTCSeconds()</code></h3>
+
+<pre class="brush: js">var theBigDay = new Date();
+theBigDay.setUTCSeconds(20);
+</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.31', 'Date.prototype.setUTCSeconds')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-date.prototype.setutcseconds', 'Date.prototype.setUTCSeconds')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-date.prototype.setutcseconds', 'Date.prototype.setUTCSeconds')}}</td>
+ <td>{{Spec2('ESDraft')}}</td>
+ <td> </td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>
+<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.setUTCSeconds")}}</p>
+</div>
+
+<h2 id="另见">另见</h2>
+
+<ul>
+ <li>{{jsxref("Date.prototype.getUTCSeconds()")}}</li>
+ <li>{{jsxref("Date.prototype.setSeconds()")}}</li>
+</ul>