Copyright © tutorialspoint.com

Javascript Date setMilliseconds() Method

previous next

Advertisements


Description:

Javascript date setMilliseconds() method sets the milliseconds for a specified date according to local time.

Syntax:

Date.setMilliseconds(millisecondsValue)

Note: Paramters in the bracket are always optional

Here is the detail of parameters:

If you specify a number outside the expected range, the date information in the Date object is updated accordingly. For example, if you specify 1010, the number of seconds is incremented by 1, and 10 is used for the milliseconds.

Return Value:

NA

Example:

<html>
<head>
<title>JavaScript setMilliseconds Method</title>
</head>
<body>
<script type="text/javascript">
   var dt = new Date( "Aug 28, 2008 23:30:00" );
   dt.setMilliseconds( 1010 );
   document.write( dt ); 
</script>
</body>
</html>

This will produce following result :

Thu Aug 28 23:30:01 UTC+0530 2008 

To understand it in better way you can Try it yourself.


previous next

Copyright © tutorialspoint.com