Copyright © tutorialspoint.com

Javascript Date getTime() Method

previous next

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:

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

Copyright © tutorialspoint.com