Create a date object using UTC time instead of local time: - Javascript Date

Javascript examples for Date:UTC

Description

Create a date object using UTC time instead of local time:

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 ww.  ja v a  2 s. co m
    var d = new Date(Date.UTC(2012, 02, 30));
    document.getElementById("demo").innerHTML = d;
}
</script>

</body>
</html>

Related Tutorials