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月.
valueOf() は Date インスタンスのメソッドで、この日時の、 1970 年 1 月 1 日午前 0 時 (UTC) を元期として定義し、それからのミリ秒数を返します。
なし。
この日時をミリ秒単位で表したタイムスタンプの数値。日付が無効である場合は NaN を返します。
valueOf() メソッドは、型変換プロトコルの一部です。 Date には [Symbol.toPrimitive]() メソッドがあるため、 Date オブジェクトが暗黙的に文字列へ変換される場合、このメソッドが常に valueOf() よりも優先されます。ただし、 Date.prototype[Symbol.toPrimitive]() は、内部では依然として this.valueOf() を呼び出します。
Date オブジェクトは、 Object の valueOf() メソッドを上書きします。 Date.prototype.valueOf() は、日付のタイムスタンプを返します。これは、 Date.prototype.getTime() メソッドと機能的に同等です。
| ECMAScript® 2027 Language Specification # sec-date.prototype.valueof |
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.