Online Training Spring Hibernate Training in Delhi R Programming Training Course Big Data and Hadoop Training Java Training

JavaScript getMilliseconds method

JavaScript method getMilliseconds() returns the milliseconds value in the Date object using the local time.

Ads

Tutorials   
Ads

JavaScript getMilliseconds method

     

JavaScript method getMilliseconds() returns the milliseconds value in the Date object using the local time. 

 

 

 

 

 

 

 function getTimeInMilliFunc(){
		var myDate = new Date(); 
	    	alert(myDate.getMilliseconds());
	    }

To illustrate getMilliseconds() method here we have created a button in the HTML page when you click on this button it calls the function getTimeInMilliFunc() as defined in the script tag. In the above code getMilliseconds() returns a three digit number that represents time in milliseconds from the local time.

Here is the full JavaScript code with HTML code as follows:

<html>
<head>
	<title>Get time in milliseconds</title>
	<script>
	function getTimeInMilliFunc(){
			var myDate = new Date(); 
	    	alert(myDate.getMilliseconds());
	    	}
	</script>	
</head>
<body>
<div style="background: #f3449c; width:'100%';"
 align="center">
  <font color="#0000ff" size="12pt">
	<b>Get time in milliseconds</b>
  </font>
 </div>
  <center>
  <p>&nbsp;</p>
  <input type="button" onclick="getTimeInMilliFunc();"
     value="Time in milliseconds">
</center>
</body>
</html>

Output :

When you will click on the button "Time in milliseconds" it will show the time in milliseconds from the date object into local time.

You can also download full HTML code from the following link.

Download Source Code

     

Advertisements

Ads
Share on Google+Share on Google+

JavaScript getMilliseconds method

Posted on: February 7, 2009 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: JavaScript getMilliseconds method  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads