Javascript examples for Date:valueOf
The valueOf() method returns the primitive value of a Date object as the number of millisecond since midnight January 1, 1970 UTC.
None
A Number, representing the number of milliseconds between the date object and midnight January 1, 1970 UTC
The following code shows how to return the primitive value of a Date object:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from www .j a va 2 s . co m*/ var d = new Date(); var n = d.valueOf(); document.getElementById("demo").innerHTML = n; } </script> </body> </html>