<time>
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
<time datetime="YYYY-MM-DDTHH:MM:SS">Displayed Time</time>
time
Demo
Meeting starts at .
<p>
Meeting starts at
<time datetime="2024-09-08T14:30:00">2:30 PM on September 8, 2024</time>.
</p>
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.
<sup>
The HTML <sup> element formats text as superscript, positioning it above the baseline. This is often used for footnotes, exponents, and mathematical expressions.
<tt>
The HTML <tt> element, which is now deprecated, was used to present text in a typewriter or monospace font. Today, the <code> element or CSS is recommended for achieving similar formatting.