English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript getMilliseconds() method

 JavaScript Date Object

getMilliseconds()Returns the milliseconds (0-999)

getMilliseconds()The returned value is between 0 and999The number between

Syntax:

date.getMilliseconds()
var d = new Date();
d.getMilliseconds();
Test and See‹/›

Browser compatibility

All browsers fully support the getMilliseconds() method:

Method
getMilliseconds()isisisisis

Technical details

Return value:and999The integer between
JavaScript version:ECMAScript 1

More Examples

Return the milliseconds for a specific date and time:

var d = new Date(#39;August 20, 1999 23:15:30:420');
d.getMilliseconds();
Test and See‹/›

Use the getHours(), getMinutes(), getSeconds(), and getMilliseconds() methods to display the time:

setInterval(function () {
   var date = new Date();
   var x = document.getElementById('result');
   x.innerHTML = date.getHours() + :" + date.getMinutes() + :" + date.getSeconds() + 
   ':' + date.getMilliseconds();
}, 1);
Test and See‹/›

 JavaScript Date Object