Export (0) Print
Expand All

getMilliseconds Method (JavaScript)

Returns the milliseconds value in a Date object using local time.

dateObj.getMilliseconds() 

The required dateObj reference is a Date object.

To get the number of milliseconds in Universal Coordinated Time (UTC), use the getUTCMilliseconds method.

The millisecond value returned can range from 0-999.

The following example illustrates the use of the getMilliseconds method.

function TimeDemo(){
   var d, s = "The current local time is: ";
   var c = ":";
   d = new Date();
   s += d.getHours() + c;
   s += d.getMinutes() + c;
   s += d.getSeconds() + c;
   s += d.getMilliseconds();
   return(s);
}

Supported in the following document modes: Quirks, Internet Explorer 6 standards, Internet Explorer 7 standards, Internet Explorer 8 standards, Internet Explorer 9 standards. See Version Information.

Applies To: Date Object (JavaScript)

Community Additions

Show:
© 2014 Microsoft