mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2026-02-27 01:21:38 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/date-gettime.html" width="100%"></iframe></div>
|
||||
<p class="hidden">The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone <a class="external" href="https://github.com/mdn/interactive-examples" rel="noopener">https://github.com/mdn/interactive-examples</a> and send us a pull request.</p>
|
||||
<h2 id="Syntax" name="Syntax">语法</h2>
|
||||
<pre class="syntaxbox"><code>dateObj.getTime() </code></pre>
|
||||
<pre><code class="language-javascript"><code>dateObj.getTime() </code></code></pre>
|
||||
<h3 id="Parameters" name="Parameters">参数</h3>
|
||||
<p>无。</p>
|
||||
<h3 id="Description" name="Description">返回值</h3>
|
||||
@@ -13,13 +13,13 @@
|
||||
<h2 id="Examples" name="Examples">例子</h2>
|
||||
<h3 id="使用_getTime()_复制日期对象">使用 getTime() 复制日期对象</h3>
|
||||
<p>创建一个拥有相同时间值的日期对象。</p>
|
||||
<pre class="brush: js">var birthday = new Date(1991, 9, 17);
|
||||
<pre><code class="language-javascript">var birthday = new Date(1991, 9, 17);
|
||||
var copy = new Date();
|
||||
copy.setTime(birthday.getTime());
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h3 id="测量代码执行时间">测量代码执行时间</h3>
|
||||
<p>连续调用两个新生成的日期对象的 getTime 方法,根据两次调用的返回值求得时间差。这可以用于计算某些操作的执行时间。避免生成不必要的<a href="Reference/Date" title="此页面仍未被本地化, 期待您的翻译!"><code>Date</code></a>对象另见<a href="Reference/Global_Objects/Date/now" title="Date.now() 方法返回自1970年1月1日 00:00:00 UTC到当前时间的毫秒数。"><code>Date.now()</code></a> </p>
|
||||
<pre class="brush:js">var end, start, i;
|
||||
<pre><code class="language-js">var end, start, i;
|
||||
|
||||
start = new Date();
|
||||
for (i = 0; i < 1000; i++) {
|
||||
@@ -27,7 +27,7 @@ for (i = 0; i < 1000; i++) {
|
||||
}
|
||||
end = new Date();
|
||||
|
||||
console.log("Operation took " + (end.getTime() - start.getTime()) + " msec");</pre>
|
||||
console.log("Operation took " + (end.getTime() - start.getTime()) + " msec");</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user