The result of this method is the milliseconds of the time value contained in the receiving object. The value will be in the range 0 to 999 inclusive.
The value is computed according to UTC time co-ordinates.
<HTML>
<HEAD></HEAD>
<BODY>
<DIV ID="RESULT">000</DIV>
<SCRIPT>
// Check the accuracy of a timer by printing the milliseconds
setInterval("monitor()", 1000);
myOldMSecs = 000;
function monitor()
{
myDate = new Date();
myMsecs = myDate.getUTCMilliseconds();
myErr = myMsecs - myOldMSecs;
document.all.RESULT.innerText = myMsecs + " (" + myErr + " milliseconds of error)";
myOldMSecs = myMsecs;
}
</SCRIPT>
</BODY>
</HTML>| Prev | Home | Next |
| Date.getUTCHours() | Up | Date.getUTCMinutes() |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||