Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript getMilliseconds() Method

JavaScript getMilliseconds() Method

Date Object Reference JavaScript Date object

Example

Return the milliseconds of a time based on local time:

var d = new Date();

var n = d.getMilliseconds();

n Output result:

Try it »


Definition and Usage

The getMilliseconds() method returns the milliseconds of a time.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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 number of milliseconds.

Technical Details

JavaScript version: 1.3

More examples

Example

Return the number of milliseconds in a specified time:

var d = new Date("July 21, 1983 01:15:00:526");

var n = d.getMilliseconds();

n Output result:

526

Try it »

Display the time
How to use getHours(), getMinutes(), getSeconds() and getMilliseconds to display the current time. and getMilliseconds()


Date Object Reference JavaScript Date object