<time> Tag in HTML | Representing Date and Time

The <time> tag in HTML is used to represent a specific date, time, or both. It can also include a machine-readable datetime attribute that aids search engines and programs in understanding the date or time data in a structured format.

Key Points on <time> Tag:

Syntax of <time> Tag:

Syntax Example

<time datetime="YYYY-MM-DDTHH:MM:SS">Displayed Date or Time</time>

Example of <time> Tag in HTML:

This example demonstrates the usage of the <time> tag to represent a publication date.

Code Example

<p>This article was published on <time datetime="2023-11-11">November 11, 2023</time>.</p>

Output

This article was published on November 11, 2023.

Attributes of <time> Tag:

Examples of Common ISO 8601 Formats for datetime:

Use Cases for <time> Tag:

The <time> tag helps to provide structured information for date and time content, enhancing both the user experience and search engine readability.