[an error occurred while processing this directive]

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

                         

[an error occurred while processing this directive]