HTML <time> Tag
The <time>
HTML element is used to represent a specific period of time on web pages. It supports the datetime attribute which takes a date, time, or both, and formats it into a machine-readable format. This allows for better search engine indexing of times and dates as well as providing custom features such as reminders.
Using the <time>
element is quite straightforward — all that’s required is to open an empty <time>
tag and enter in a datetime attribute which can accepts different date and time format (for example, "2020-08-20" or "2020-08-20T16:00:00" or "PT2H30M" or "10:30").
<p><time datetime="2022-08-12T22:00">Midnight on August 12th</time></p>
<p>The film will be premiered at <time datetime="2022-12-30T20:00:00">20:00</time>.</p>
<p>The game's server will be taken down on <time datetime="2022-12-30T20:00:00"">December 30</time>.</p>
Overall, the HTML <time>
element is a new tag that allows developers to display dates and times in a structured way. This can be incredibly useful for setting calendar events or displaying the timeframe of special offers.