What Is The HTML <time> Tag?

What Is The HTML <time> Tag?

Date First Published: 20th January 2024

Topic: Web Design & Development

Subtopic: Web Development

Article Type: Computer Terms & Definitions

Difficulty: Medium

Difficulty Level: 5/10

Learn about what the HTML <time> tag is in this article.

In HTML, the <time> tag is used to represent a time period. It is used to tell web browsers that the text is time-related and helps users with assistive technologies. It can also be used to present dates and times in a machine-readable format, which enables events to be scheduled in a user's calendar and search engines to produce more detailed search results. This tag is supported by all modern web browsers.

Examples Of The <time> Tag

Below are two examples of the <time> tag.

<p>The dentist is open from <time>08:00</time> to <time>18:00</time> every weekday.</p>
<p>This article was published on <time>2024-01-22</time></p>

The dentist is open from to every weekday.

This article was published on

In the examples above, the time element tells the browser that "08:00", "18:00", and "2024-01-22" is referring to time. It is not visible to users, but is used by web browsers to display the same information found in the text content of the time element.

Attributes

The time tag has one unique attribute in addition to the standard attributes that define the settings of a HTML element.

  • Datetime - Used to designate a machine-readable date and time in a time element.


Feedback

  • Is there anything that you disagree with on this page?
  • Are there any spelling, grammatical, or punctuation errors on this page?
  • Are there any broken links or design errors on this page?

If so, it is important that you tell me as soon as possible on this page.


Comments