Export (0) Print
Expand All
1 out of 1 rated this helpful - Rate this topic

valueOf Method (Date)

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

date.valueOf()

The date object is any instance of a Date.

The stored time value in milliseconds since midnight, January 1, 1970 UTC. This is the same value as getTime.

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 

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards, Internet Explorer 10 standards, Internet Explorer 11 standards. Also supported Store apps (Windows 8 and Windows Phone 8.1). See Version Information.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.