JavaScript Date valueOf() method

Definition and usage

valueOf() The method returns the original value of the Date object.

Note:The original value is returned in the form of milliseconds since midnight UTC on January 1, 1970.

Example

Returns the original value of the Date object:

var d = new Date();
var n = d.valueOf();

Try it yourself

Syntax

Date.valueOf()

Parameter

No parameters.

Technical details

Return value: A number representing the milliseconds between the date object and midnight UTC on January 1, 1970.
JavaScript version: ECMAScript 1

Webbläsarstöd

Metoder Chrome IE Firefox Safari Opera
valueOf() Stöd Stöd Stöd Stöd Stöd

Relaterade sidor

Lärplattform:JavaScript datum

Lärplattform:JavaScript datumformat