Tutorials Point


  JavaScript Basics
  JavaScript Objects
  JavaScript Advanced
  JS Useful References
  JS Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     Discussion Forums     About TP  

Javascript Date getTime() Method


previous next AddThis Social Bookmark Button


Advertisements

Description:

Javascript date getTime() method returns the numeric value corresponding to the time for the specified date according to universal time. The value returned by the getTime method is the number of milliseconds since 1 January 1970 00:00:00.

You can use this method to help assign a date and time to another Date object.

Syntax:

Date.getTime()

Here is the detail of parameters:

  • NA

Return Value:

Returns the numeric value corresponding to the time for the specified date according to universal time.

Example:

<html>
<head>
<title>JavaScript getTime Method</title>
</head>
<body>
<script type="text/javascript">
   var dt = new Date( "December 25, 1995 23:15:20" );
   document.write("getTime() : " + dt.getTime() ); 
</script>
</body>
</html>

This will produce following result:

getTime() : 819913520000

To understand it in better way you can Try it yourself.



previous next Printer Friendly

Advertisements


  

Advertisements