JavaScript getMilliseconds Method





The getMilliseconds method returns the milliseconds since the last second of the point in time stored in a Date object. The value returned by this method is an integer number from 0 to 999.


Syntax

myDate.getMilliseconds()

With myDate being an object based on the Date object.


Example

The following code uses the getMilliseconds method to return the milliseconds since the last second of the current instant of time:

<script type="text/javascript">

var currentDate = new Date();
var milliseconds = currentDate.getMilliseconds();

document.write("The milliseconds passed since the last second are: " + milliseconds + ".");

</script>


Technical Details

The getMilliseconds method belongs to the Date object, it is available since the version 1.3 of JavaScript, and it is supported in all major browsers.





JavaScript Manual >> Date Object >> getMilliseconds Method





© Copyright 2010-2016 ROM Cartridge