Open In App

How to display the time in HTML ?

The <time> Tag is used to display the human-readable date/time. It can also be used to encode dates and times in a machine-readable form. The main advantage for users is that they can offer to add birthday reminders or scheduled events to their calendars and search engines can produce smarter search results.

Syntax

<time attribute> Time... </time>

Example:






<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content=
          "width=device-width, initial-scale=1.0">
    <title>Time Element</title>
</head>
 
<body>
    <p>Published on
      <time datetime="2024-01-31">January 31, 2024</time>
      </p>
</body>
 
</html>

Output:



Article Tags :