DEV Community

Zoya Khan
Zoya Khan

Posted on

HTML Code for Date and Time Tool

<!DOCTYPE html>
<html>
  <head>
    <title>Current Date and Time</title>
  </head>
  <body>
    <h1>Current Date and Time</h1>
    <p>
      The current date and time is: <span id="datetime"></span>
    </p>
    <script>
      var datetimeElement = document.getElementById("datetime");
      var now = new Date();
      datetimeElement.textContent = now.toString();
    </script>
  </body>
</html>

Enter fullscreen mode Exit fullscreen mode

Top comments (2)

Collapse
 
zoyakhanblogger profile image
Zoya Khan

thank you so much :)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay