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 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

Browser support

Metode Chrome IE Firefox Safari Opera
valueOf() Support Support Support Support Support

Relaterede sider

Tutorial:JavaScript dato

Tutorial:JavaScript datoformat