I am following the W3Schools tutorial on javascript Date object and trying to display the time in hh:mm:ss.msmsms format.
<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to display a date after changing the hours, minutes, and seconds.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var d = new Date();
d.setHours(07,01,01,312);
var x = document.getElementById("demo");
x.innerHTML=d;
}
</script>
</body>
</html>
I was expecting 07:01:01.312
(as in hh:mm:ss.msmsms) but it shows
Sun Feb 23 2014 07:01:01 GMT-0600 (CST)
How can i get javascript to displace 07:01:01.312
?