0
7.9kviews
Write a JavaScript program to display todays date and time
1 Answer
0
163views

Code:

<html>
<body>
        <p id="demo"></p>
        <script>
            document.getElementById("demo").innerHTML = Date();
        </script>
</body>
</html>

Alternative:

Javascript code to display Current Date and Time :

<html>
    <body>
<script type="text/javascript">
    var currentDate = new Date()
    var day = currentDate.getDate()
    var month = currentDate.getMonth() + 1
    var year = currentDate.getFullYear()
    document.write("<b>" + day + "/" …

Create a free account to keep reading this post.

and 4 others joined a min ago.

Please log in to add an answer.