• JavaScript Video Tutorials

JavaScript Date - valueOf Method



Description

This method returns the primitive value of a Date object as a number data type, the number of milliseconds since midnight 01 January, 1970 UTC.

Syntax

Its syntax is as follows −

Date.valueOf ()

Return Value

Returns the primitive value of a Date object.

Example

Try the following example.

<html>
   <head>
      <title>JavaScript valueOf Method</title>
   </head>
   
   <body>   
      <script type = "text/javascript">
         var dateobject = new Date(1993, 6, 28, 14, 39, 7);
         document.write( dateobject.valueOf() ); 
      </script>      
   </body>
</html>

Output

743850547000 
javascript_date_object.htm
Advertisements