JavaScript getMilliseconds()Method
Examples
Returns the milliseconds of a time according to local time:
var d = new Date();
var n = d.getMilliseconds();
var n = d.getMilliseconds();
nOutput:
Try it Yourself »
Definition and Usage
The getMilliseconds() method returns the milliseconds of a time.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the getMilliseconds() method
Syntax
Date.getMilliseconds()
Return Value
| Type | Description |
|---|---|
| Number | The return value is an integer between 0 and 999, representing the milliseconds. |
Technical Details
| JavaScript Version: | 1.3 |
|---|
More Examples
Examples
Return the number of milliseconds in a specified time:
var d = new Date("July 21, 1983 01:15:00:526");
var n = d.getMilliseconds();
var n = d.getMilliseconds();
nOutput:
526
Try it Yourself »
Display Time
How to use getHours(), getMinutes(), getSeconds(), and getMilliseconds() to display the current time.
Other Extensions
JavaScript Date Object