This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

getMilliseconds

Summary

Gets the milliseconds of a Date, using local time.

Syntax

dateObj.getMilliseconds()

Return Value

Returns the milliseconds of a date. The value can range from 0-999. If a date has been constructed without specifying the milliseconds, the value returned is 0.

Examples

The following example shows how to use the getMilliseconds method.

var date = new Date("1/1/2001");
 document.write(date.getMilliseconds());
 document.write("<br/>");

 date.setMilliseconds(5);
 document.write(date.getMilliseconds());
 // Output:
 // 0
 // 5

Remarks

The required dateObj reference is a Date object. To get the number of milliseconds in Universal Coordinated Time (UTC), use the getUTCMilliseconds method.

See also

Other articles

Attributions

  • Microsoft Developer Network: Article