[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/zh-TW/docs/Web/JavaScript/Reference/Global_Objects/Date/valueOf [Back]  [Original]

Date.prototype.valueOf() - JavaScript | MDN

MDN Web Docs

View in English Always switch to English

Date.prototype.valueOf()

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 20157.

Date valueOf() UTC 1970 1 1

In this article

const date1 = new Date(Date.UTC(96, 1, 2, 3, 4, 5));

console.log(date1.valueOf());
// 823230245000

const date2 = new Date("02 Feb 1996 03:04:05 GMT");

console.log(date2.valueOf());
// 823230245000

js
valueOf()

NaN

valueOf() Date [Symbol.toPrimitive]() Date valueOf()Date.prototype[Symbol.toPrimitive]() this.valueOf()

Date Object valueOf() Date.prototype.valueOf() Date.prototype.getTime()

valueOf()

js
const d = new Date(0); // 1970-01-01T00:00:00.000Z
console.log(d.valueOf()); // 0

Specification
ECMAScript 2027 LanguageSpecification
# sec-date.prototype.valueof


Web Proxy Viewer  |  New URL  |  Original Page