diff options
Diffstat (limited to 'files/zh-cn/web/javascript/reference/global_objects/date/toutcstring/index.html')
-rw-r--r-- | files/zh-cn/web/javascript/reference/global_objects/date/toutcstring/index.html | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/files/zh-cn/web/javascript/reference/global_objects/date/toutcstring/index.html b/files/zh-cn/web/javascript/reference/global_objects/date/toutcstring/index.html new file mode 100644 index 0000000000..4889075b1c --- /dev/null +++ b/files/zh-cn/web/javascript/reference/global_objects/date/toutcstring/index.html @@ -0,0 +1,76 @@ +--- +title: Date.prototype.toUTCString() +slug: Web/JavaScript/Reference/Global_Objects/Date/toUTCString +translation_of: Web/JavaScript/Reference/Global_Objects/Date/toUTCString +--- +<div>{{JSRef("Global_Objects", "Date")}}</div> + +<p><code><strong>toUTCString()</strong></code> 方法把一个日期转换为一个字符串,使用UTC时区。</p> + +<div>{{EmbedInteractiveExample("pages/js/date-toutcstring.html")}}</div> + + + +<h2 id="Syntax" name="Syntax">语法</h2> + +<pre class="syntaxbox"><var>dateObj</var>.toUTCString()</pre> + +<h3 id="Parameters" name="Parameters">返回值</h3> + +<p>返回使用UTC时区表示给定日期的字符串</p> + +<p> </p> + +<h2 id="Description" name="Description">描述</h2> + +<p><code>toUTCString</code> 的返回值是一个使用UTC时区的易读格式字符串。返回值的格式可能随平台而变化。通常返回值是一个 RFC-1123 格式的时间戳,这是一个 RFC-822 时间戳的小幅更新版。</p> + +<h2 id="Examples" name="Examples">例子</h2> + +<h3 id="Example:_Using_toUTCString" name="Example:_Using_toUTCString">例子:使用<code>toUTCString</code></h3> + +<pre>var today = new Date(); +var UTCstring = today.toUTCString(); +// Mon, 03 Jul 2006 21:44:38 GMT +</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>ECMAScript 1st Edition. Implemented in JavaScript 1.3</td> + <td>Standard</td> + <td>Initial definition.</td> + </tr> + <tr> + <td>{{SpecName('ES5.1', '#sec-15.9.5.42', 'Date.prototype.toUTCString')}}</td> + <td>{{Spec2('ES5.1')}}</td> + <td> </td> + </tr> + <tr> + <td>{{SpecName('ES6', '#sec-date.prototype.toutcstring', 'Date.prototype.toUTCString')}}</td> + <td>{{Spec2('ES6')}}</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.toUTCString")}}</p> + +<h2 id="See_Also" name="See_Also">相关链接</h2> + +<ul> + <li>{{jsxref("Date.prototype.toLocaleString()")}}</li> + <li>{{jsxref("Date.prototype.toDateString()")}}</li> + <li>{{jsxref("Date.prototype.toISOString()")}}</li> +</ul> |