Dùng getMilliseconds() lấy mili-giây (0-999) của đối tượng Date theo giờ địa phương. Để lấy timestamp (mili-giây từ epoch) dùng Date.now() hoặc new Date().getTime().
Ví dụ
<html>
<head>
<title>Phương thức getMilliseconds trong JavaScript</title>
</head>
<body>
<script>
var dt = new Date();
document.write("Mili-giây: " + dt.getMilliseconds());
</script>
</body>
</html>