aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/javascript/reference/global_objects/date/setutcminutes/index.html
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/setutcminutes/index.html
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/setutcminutes/index.html')
-rw-r--r--files/zh-cn/web/javascript/reference/global_objects/date/setutcminutes/index.html92
1 files changed, 92 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/setutcminutes/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/setutcminutes/index.html
new file mode 100644
index 0000000000..7ea6d1ed0b
--- /dev/null
+++ b/files/zh-cn/web/javascript/reference/global_objects/date/setutcminutes/index.html
@@ -0,0 +1,92 @@
+---
+title: Date.prototype.setUTCMinutes()
+slug: Web/JavaScript/Reference/Global_Objects/Date/setUTCMinutes
+translation_of: Web/JavaScript/Reference/Global_Objects/Date/setUTCMinutes
+---
+<div>{{JSRef}}</div>
+
+<div> </div>
+
+<p><strong><code>setUTCMinutes()</code></strong>方法会根据世界协调时(UTC)来设置指定日期的分钟数。</p>
+
+<div>{{EmbedInteractiveExample("pages/js/date-setutcminutes.html")}}</div>
+
+
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox"><code><var>dateObj</var>.setUTCMinutes(<var>minutesValue</var>[, <var>secondsValue</var>[, <var>msValue</var>]])</code></pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>minutesValue</code></dt>
+ <dd>必填,表示要设置的分钟数,是一个介于0和59之间的整数。</dd>
+ <dt><code>secondsValue</code></dt>
+ <dd>可选参数,表示要设置的秒数,同样也是一个介于0和59之间的整数,如果你传入了这个参数,那么你就必须要传入上一个参数(<strong><code>minutesValue</code></strong>)。</dd>
+ <dt><code>msValue</code></dt>
+ <dd>可选参数,表示要设置的毫秒数,这是一个介于0和999之间的数字,如果你传入了这个参数,那么你就必须要传入前面两个参数(<strong><code>minutesValue</code></strong>和<strong><code>secondsValue</code></strong>)。</dd>
+</dl>
+
+<h3 id="返回值">返回值</h3>
+
+<p>返回从UTC时间1970年1月1日0时0分0秒至设置后的时间的毫秒数。</p>
+
+<h2 id="说明">说明</h2>
+
+<p>如果你没有传入后两个参数(<strong><code>minutesValue</code></strong>和<strong><code>msValue</code></strong>),这两个参数会分别使用{{jsxref("Date.prototype.getUTCSeconds()", "getUTCSeconds()")}}和{{jsxref("Date.prototype.getUTCMilliseconds()", "getUTCMilliseconds()")}}这两个方法返回的值。</p>
+
+<p>如果你传入的参数值在上文所述范围之外的话,<code><strong>setUTCMinutes()</strong></code>方法会尝试修改日期对象中的其他信息,比如说你为<code><strong>secondsValue</strong></code>这个参数传入了100(译者注:规定范围是[0, 59]),那么第一个参数(<code><strong>minutesValue</strong></code>)就会被加1,而秒数则变成了40。</p>
+
+<h2 id="例子">例子</h2>
+
+<h3 id="使用_setUTCMinutes()">使用 <code>setUTCMinutes()</code></h3>
+
+<pre class="brush: js">var theBigDay = new Date();
+theBigDay.setUTCMinutes(43);
+</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.33', 'Date.prototype.setUTCMinutes')}}</td>
+ <td>{{Spec2('ES5.1')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ES6', '#sec-date.prototype.setutcminutes', 'Date.prototype.setUTCMinutes')}}</td>
+ <td>{{Spec2('ES6')}}</td>
+ <td> </td>
+ </tr>
+ <tr>
+ <td>{{SpecName('ESDraft', '#sec-date.prototype.setutcminutes', 'Date.prototype.setUTCMinutes')}}</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.setUTCMinutes")}}</p>
+
+<h2 id="相关知识">相关知识</h2>
+
+<ul>
+ <li>{{jsxref("Date.prototype.getUTCMinutes()")}}</li>
+ <li>{{jsxref("Date.prototype.setMinutes()")}}</li>
+</ul>