Set the time to 15:35:01 - Javascript Date

Javascript examples for Date:setHours

Description

Set the time to 15:35:01

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*  w  w  w  .ja v a2s .c om*/
    var d = new Date();
    d.setHours(15, 35, 1);
    document.getElementById("demo").innerHTML = d;
}
</script>

</body>
</html>

Related Tutorials