|
| JAVASCRIPT getTime() METHOD
The getTime() method in javascript returns the number of milliseconds of time elapsed since the epoch ie. 1 January 1970, 00:00:00.
The general format is:
dateObject.getTime();
If you want to return the milliseconds elapsed since the epoch with getTime() method, you will first have to create a new date object and then use the new date object with the getTime() method.
Example 1:
<script type="text/javascript">
var ms=new Date(); // creates a new date object
ms=ms.getTime(); // returns the milliseconds since the epoch
document.write(ms); // outputs the milliseconds since the epoch
</script>
The above will output:
See Also:
|
|