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 of January 1, 1970 UTC.

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 of January 1, 1970 UTC.
JavaScript Version: ECMAScript 1

Browser Support

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

Related Pages

Tutorial:JavaScript Date

Tutorial:JavaScript Date Format