mirror of
https://github.com/fofolee/uTools-Manuals.git
synced 2025-12-20 02:05:48 +08:00
语法高亮,滚动条美化,设置页面调整
This commit is contained in:
@@ -4,13 +4,13 @@
|
||||
<div><iframe class="interactive interactive-js" frameborder="0" height="250" src="https://interactive-examples.mdn.mozilla.net/pages/js/date-tojson.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><var>dateObj</var>.toJSON()</code>
|
||||
</pre>
|
||||
<pre><code class="language-javascript"><code><var>dateObj</var>.toJSON()</code>
|
||||
</code></pre>
|
||||
<h2 id="Description" name="Description">描述</h2>
|
||||
<p><a href="Reference/Date" title="此页面仍未被本地化, 期待您的翻译!"><code>Date</code></a> 实例引用一个具体的时间点。 调用 <code>toJSON()</code> 返回一个 JSON 格式字符串(使用 <a href="Reference/Global_Objects/Date/toISOString" title="toISOString() 方法返回一个 ISO(ISO 8601 Extended Format)格式的字符串: YYYY-MM-DDTHH:mm:ss.sssZ。时区总是UTC(协调世界时),加一个后缀“Z”标识。"><code>toISOString()</code></a>),表示该日期对象的值。默认情况下,这个方法常用于 <a class="glossaryLink" href="/en-US/docs/Glossary/JSON" title="JSON: JavaScript Object Notation (JSON) is a data-interchange format. Although not a strict subset, JSON closely resembles a subset of JavaScript syntax. Though many programming languages support JSON, JSON is especially useful for JavaScript-based apps, including websites and browser extensions.">JSON</a>序列化<a href="Reference/Date" title="此页面仍未被本地化, 期待您的翻译!"><code>Date</code></a>对象。</p>
|
||||
<h2 id="Example" name="Example">样例</h2>
|
||||
<h3 id="Example:_Using_toJSON" name="Example:_Using_toJSON"><code>toJSON()</code> 样例</h3>
|
||||
<pre class="brush:js">var date = new Date();
|
||||
<pre><code class="language-js">var date = new Date();
|
||||
console.log(date); //Thu Nov 09 2017 18:54:04 GMT+0800 (中国标准时间)
|
||||
|
||||
var jsonDate = (date).toJSON();
|
||||
@@ -18,7 +18,7 @@ console.log(jsonDate); //"2017-11-09T10:51:11.395Z"
|
||||
|
||||
var backToDate = new Date(jsonDate);
|
||||
console.log(backToDate); //Thu Nov 09 2017 18:54:04 GMT+0800 (中国标准时间)
|
||||
</pre>
|
||||
</code></pre>
|
||||
<h2 id="规范">规范</h2>
|
||||
<table class="standard-table">
|
||||
<tbody>
|
||||
|
||||
Reference in New Issue
Block a user