HTML Tags

HTML <time> Tag

The <time> tag defines a specific time or date, or both.
It helps browsers, search engines, and assistive technologies understand the time-related data in a machine-readable format using the datetime attribute.

Syntax

html

<time datetime="YYYY-MM-DDThh:mm:ssTZD">Visible Time or Date</time>

Attributes

AttributeDescription
datetimeSpecifies the date and/or time in a machine-readable format (e.g., 2025-11-01T10:00).
idDefines a unique identifier for the element.
classDefines one or more class names for CSS styling.
styleApplies inline CSS styles.

💡 Note: The datetime attribute helps search engines understand structured data, improving SEO.

Example

html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Time Tag Example</title>
</head>
<body>
  <h1>HTML <time> Tag Example</h1>
  <p>The seminar will start at <time datetime="2025-11-05T14:00">2:00 PM, November 5, 2025</time>.</p>
</body>
</html>

Output

Browser Output

html

The visible text will be displayed as:
“2:00 PM, November 5, 2025”

However, browsers and search engines can read the datetime attribute as machine-readable information.
You can try this in our TryIt Editor to view the output and inspect the HTML for structured data.

Browser Support

Chrome
Edge
Firefox
Safari
Opera
IE9+
YesYesYesYesYesPartially

All browsers support this <time> tag, but IE has limited support for this.

Notes

  • The <time> tag does not change how text looks by default.
  • It allows search engines and other applications to extract and understand time-based information.
  • Always use ISO 8601 format for the datetime attribute (e.g., 2025-11-01T09:30).
  • The tag improves SEO and accessibility for date and time content.

Conclusion

The <time> tag is a semantic and SEO-friendly way to represent dates and times.
It makes your web content more meaningful for both users and search engines, especially for event-based or time-sensitive information.