Web | This Site

JavaScript Basics
JavaScript Objects
JavaScript Advanced
JS Useful References
JS Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# Javascript Date setMilliseconds() Method

## 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:

- millisecondsValue : A number between 0 and 999, representing the milliseconds.

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.

Advertisement

Online Image Processing

Indian Baby Names