|
| JAVASCRIPT getUTCMilliseconds() METHOD
The getUTCMilliseconds() method in javascript returns the milliseconds of time in UTC (Universal Coordinated Time) as numbers from 0 to 999.
The general format is:
dateObject.getUTCMilliseconds();
If you want to return the milliseconds with getUTCMilliseconds()method, you will first have to create a new date object and then use the new date object with the getUTCMilliseconds() method.
Example 1: Using getUTCMilliseconds() for the milliseconds of the current time
<script type="text/javascript">
var ss=new Date(); // creates new date object
ss=ss.getUTCMilliseconds(); // returns milliseconds
document.write(ss); // outputs milliseconds
</script>
The above will output:
Example 2: Using getUTCMilliseconds() to get the milliseconds of a specified date/time:
<script type="text/javascript">
var ss=new Date("January 16, 2008 21:37:23");
ss=ss.getUTCMilliseconds();
document.write(ss);
</script>
The above will output:
See Also:
|
|