X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

JavaScript Date valueOf() Method

Date Object Reference JavaScript Date Object

Example

Return the primitive value of a Date object:

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

The result of n will be:


Try it yourself »


Definition and Usage

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

Note: The primitive value is returned as the number of millisecond since midnight January 1, 1970 UTC.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The valueOf() method is supported in all major browsers.


Syntax

Date.valueOf()

Parameters

None.

Return Value

Type Description
Number Milliseconds between the date object and midnight January 1, 1970 UTC

Technical Details

JavaScript Version: 1.1


Date Object Reference JavaScript Date Object

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook