Copyright ©

Javascript Date setMilliseconds() Method

previous next



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



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:



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

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 ©