<!DOCTYPE html>
<html>
<body>
<p id="demo">Display the result here.</p>
<script>
var date = new Date();
document.getElementById("demo").innerHTML = date;
</script>
</body>
</html>
Exercise no. 2:
<!DOCTYPE html>
<html>
<body>
<p id="demo">Display the result here.</p>
<script>
var date = new Date(2015, 0, 10, 10, 0, 0, 0);
document.getElementById("demo").innerHTML = date;
</script>
</body>
</html>
Exercise no. 3:
<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<script>
var date = new Date();
document.getElementById("demo").innerHTML = date.toDateString();
</script>
</body>
</html>
No comments:
Post a Comment