This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

valueOf

Summary

Returns the stored time value in milliseconds since midnight, January 1, 1970 UTC.

Syntax

date.valueOf()

Return Value

The stored time value in milliseconds since midnight, January 1, 1970 UTC. This is the same value as getTime. The date object is any instance of a Date.

Examples

The following example illustrates the use of the valueOf method with a date.

var myDate = new Date();
 myDate.setFullYear(2100, 5, 5);
 if (myDate.getTime() == myDate.valueOf())
     document.write("values are the same");
 else
     document.write("values are different");

 // Output: values are the same

Attributions

  • Microsoft Developer Network: Article