aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/javascript/reference/global_objects/date/togmtstring/index.html
blob: abf87e5cc06e98b6c165637a20293e818d88dbb0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
title: Date.prototype.toGMTString()
slug: Web/JavaScript/Reference/Global_Objects/Date/toGMTString
tags:
  - Date
  - Deprecated
  - JavaScript
  - Method
  - Prototype
  - Reference
translation_of: Web/JavaScript/Reference/Global_Objects/Date/toGMTString
---
<div>{{JSRef}} {{deprecated_header}}</div>

<p><strong><code>toGMTString()</code></strong> メソッドは、インターネットグリニッジ標準時 (GMT) 協定に基づき、日付を文字列へ変換します。<code>toGMTString()</code> が返す値の正確な書式は、プラットフォームやブラウザによって変化しますが、一般に、人間が読める日付の文字列を表します。</p>

<div class="note">
<p><strong>注:</strong> <code>toGMTString()</code> は非推奨であり、もはや使われていません。後方互換性のためだけに残されています。代わりに、{{jsxref("Date.prototype.toUTCString()", "toUTCString()")}} を使用してください。</p>
</div>

<h2 id="Syntax" name="Syntax">構文</h2>

<pre class="syntaxbox notranslate"><var>dateObj</var>.toGMTString()</pre>

<h3 id="Return_value" name="Return_value">返値</h3>

<p>インターネットグリニッジ標準時 (GMT) 協定に基づき、与えられた日付を表す文字列。</p>

<h2 id="Examples" name="Examples"></h2>

<h3 id="Simple_example" name="Simple_example">簡単な例</h3>

<p>この例では、<code>toGMTString()</code> メソッドは OS のタイムゾーンオフセットを使って、日付を GMT (UTC) に変換し、次の書式に似た文字列値を返します。正確な書式はプラットフォームに依存します。</p>

<pre class="brush: js notranslate">var today = new Date();
var str = today.toGMTString();  // deprecated! use toUTCString()

console.log(str);               // Mon, 18 Dec 1995 17:28:35 GMT
</pre>

<h2 id="Specifications" name="Specifications">仕様書</h2>

<table class="standard-table">
 <thead>
  <tr>
   <th scope="col">仕様書</th>
  </tr>
 </thead>
 <tbody>
  <tr>
   <td>{{SpecName('ESDraft', '#sec-date.prototype.togmtstring', 'Date.prototype.toGMTString')}}</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility" name="Browser_compatibility">ブラウザーの互換性</h2>

<p>{{Compat("javascript.builtins.Date.toGMTString")}}</p>

<h2 id="See_also" name="See_also">関連情報</h2>

<ul>
 <li>{{jsxref("Date.prototype.toLocaleDateString()")}}</li>
 <li>{{jsxref("Date.prototype.toTimeString()")}}</li>
 <li>{{jsxref("Date.prototype.toUTCString()")}}</li>
</ul>