Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Javascript JavaScript getMilliseconds method

Related Tutorials


 
 

Share on Google+Share on Google+

JavaScript getMilliseconds method

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

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

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: February 7, 2009

Related Tutorials

Discuss: JavaScript getMilliseconds method  

Post your Comment


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