In this JavaScript program, you will learn how to display date and time in JavaScript. Display date and time in your webpage in JavaScript program.
//Display Date and Time in JavaScript<!DOCTYPE html>
<html>
<body>
<h1>My First JavaScript</h1>
<button type="button"
onclick="document.getElementById('clock').innerHTML = Date()">
Click Here to Display Date and Time.</button>
<p id="clock"></p>
</body>
</html>
The output of the program:
When you run this program in your browser, you can see that.
Display Date and Time |
When you click the option, Click Here to Display Date and Time, you can see that the default date and time in your computer.
display date and time in javascript |
0 Comments