Date.getMilliseconds()
JavaScript 1.2+, ECMAScript 1.0+, JScript 3.0+ Nav4+, IE 4+ Syntax
date.getMilliseconds()
Description
The getMilliseconds() method returns the millisecond portion of the date expressed as an integer from 0 to 999.
Example
The code in Listing 6.75 displays the milliseconds in the Date object using the getMilliseconds() method.
Listing 6.75 Using the getMilliseconds() Method to Return the Current Millisecond
<html> <script language="JavaScript"> <!-- Hide //Create a Date object that contains the current date and time. theDate = new Date(); //Display the milliseconds document.write("The millisecond is ",theDate.getMilliseconds()); //Hide End --> </script> </html> |
Get Pure JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.