.valueOf()

Returns the difference in milliseconds between the specified date and January 1, 1970 00:00:00 UTC.

Syntax

myDate.valueOf();

Example 1

Print the value of January, 1st, 1970 at 12:00:00 AM.

const date = new Date(1999, 00, 01, 0, 0, 0, 0);
console.log(date);
// Output: Fri Jan 01 1999 00:00:00 GMT-0800 (Pacific Standard Time)
// Note: Timezone may vary
console.log(date.valueOf());
// Output: 915177600000

Contributors

Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn JavaScript on Codecademy

Contributors