Get to know MDN better
このページはコミュニティーの尽力で英語から翻訳されました。MDN Web Docs コミュニティーについてもっと知り、仲間になるにはこちらから。
This feature is well established and works across many devices and browser versions. It’s been available across browsers since 2015年7月.
toString() は Date インスタンスのメソッドで、この日時を地方時で解釈したものを表す文字列を返します。
なし。
指定された日時を表す文字列(書式については解説を参照)。日付が無効である場合は null です。
toString() メソッドは、型変換プロトコルの一部です。 Date には [Symbol.toPrimitive]() メソッドがあるため、 Date オブジェクトが暗黙的に文字列へ変換される場合、このメソッドが常に toString() よりも優先されます。ただし、 Date.prototype[Symbol.toPrimitive]() は、内部では依然として this.toString() を呼び出します。
Date オブジェクトは、 Object の toString() メソッドを上書きします。この文字列は、日付と時刻の両方が含まれており、 toDateString() と toTimeString() で指定された文字列表現が、間に空白を入れて結合されたものです。例えば、 "Thu Jan 01 1970 00:00:00 GMT+0000 (Coordinated Universal Time)" のようになります。
Date.prototype.toString() は Date インスタンスに対して呼び出されなければなりません。もし this 値が Date.prototype を継承していない場合、 TypeError が発生します。
| ECMAScript® 2027 Language Specification # sec-date.prototype.tostring |
Enable JavaScript to view this browser compatibility table.
This page was last modified on 2025年6月19日 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.