<time>

The HTML <time> element indicates a specific date or time, enabling semantic markup for date and time values that browsers and search engines can utilize for improved data interpretation.

time tag

The <time> element in HTML is used to denote a specific date or time. This helps browsers and other user agents correctly interpret and display temporal data, improving machine readability and supporting various time-sensitive applications.

Syntax

index.html
<time datetime="YYYY-MM-DDTHH:MM:SS">Displayed Time</time>

time Demo

Meeting starts at .

index.html
<p>
  Meeting starts at 
  <time datetime="2024-09-08T14:30:00">2:30 PM on September 8, 2024</time>.
</p>
The datetime attribute supplies a standardized temporal value that search engines and other tools can use, while the content within the <time> element remains visible to users.

Attributes

Like other HTML elements, <time> supports global attributes.

datetime

The datetime attribute specifies the precise date and time for the element. It must adhere to a valid date format and can include an optional time component. If the value cannot be parsed as a valid date with time, no associated timestamp is created.

See also

The <data> element, which can also be used to represent various kinds of values.

Conclusion

The <time> element is essential for representing dates and times in HTML, ensuring that temporal information is both machine-readable and accessible. The datetime attribute provides a standard timestamp that aids search engines and other tools in processing the data, while the content within the tag remains for user display.