ในการรับเวลาปัจจุบันในหน่วยมิลลิวินาที ให้ใช้เมธอด date getMilliseconds() เมธอด getMilliseconds() ของ JavaScript วันที่ส่งคืนมิลลิวินาทีในวันที่ระบุตามเวลาท้องถิ่น ค่าที่ส่งคืนโดย getMilliseconds() เป็นตัวเลขระหว่าง 0 ถึง 999
ตัวอย่าง
คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อรับเวลาปัจจุบันในหน่วยมิลลิวินาที -
<html>
<head>
<title>JavaScript getMilliseconds() Method</title>
</head>
<body>
<script>
var dt = new Date( );
document.write("getMilliseconds() : " + dt.getMilliseconds() );
</script>
</body>
</html>