Latest web development tutorials

JavaScript getMilliseconds () method

Date Object Reference JavaScript Date Object

Examples

According to local time Return time milliseconds:

var d = new Date();
var n = d.getMilliseconds();

n output:


try it"

Definition and Usage

getMilliseconds () method returns the time in milliseconds.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support getMilliseconds () method


grammar

Date.getMilliseconds()

return value

类型 描述
Number 返回值是 0 ~ 999 之间的一个整数,该数字代表毫秒数。

technical details

JavaScript version: 1.3


More examples

Examples

Returns the number of milliseconds specified period of time:

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

n output:

526

try it"
Examples s

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


Date Object Reference JavaScript Date Object