HTML Tutorial

HTML Tag: <time>

Usage:

<time> tag represents a specific point in time or a time range. It's used to provide temporal information within a web document.

Attributes:

  • datetime: Required attribute specifying the date and time in a specific format.
  • title: Optional attribute providing a tooltip with additional information about the time.
  • pubdate: Deprecated attribute representing the publication date.

Examples:

  • Specific Time: <time datetime="2023-03-08T16:30:00Z">March 8, 2023 at 4:30 PM UTC</time>
  • Time Range: <time datetime="2023-03-07T10:00:00Z/2023-03-08T16:00:00Z">March 7-8, 2023</time>

Exploring the <time> Tag (HTML Example):

<!DOCTYPE html>
<html>
<body>
  <h1>Event Details</h1>
  <ul>
    <li>Date: <time datetime="2023-04-29">April 29, 2023</time></li>
    <li>Time: <time datetime="2023-04-29T18:00:00Z">6:00 PM UTC</time></li>
  </ul>
</body>
</html>

Output:

  • Event Details
    • Date: April 29, 2023
    • Time: 6:00 PM UTC