getTime()

Returns in milliseconds that is passed from January 1, 1970
We have to use this along with one date object.
Here is an example
<script type="text/javascript"> 
var my_time = new Date(); // date object 
document.write(my_time.getTime()); // Output 
</script>
Output is here Using a button to display getTime() of current date object.

Source of this demo is here
<script type="text/javascript"> 
function show_gettime(){
var my_time = new Date(); // date object 
//document.write(my_time.getTime()); // Output 
document.getElementById('display').innerHTML = my_time.getTime();

}
</script>
<input type=button onclick='show_gettime()' value='Show';>

<div id='display'></div>

Calculating Process time or lapse time

By using gettime() we can find out time taken by any calculation or any other process by finding the difference in milliseconds from start and end of the process.

Calculate the Process duration

Your Rating





More on JavaScript Date & Time

Post Comment This is for short comments only. Use the forum for more discussions.




HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer