- What does
<time> HTML Tagdo?
- Defines a datetime. The content of a time element is typically a human-readable date and time, and a machine-readable version of the same time is placed in the datetime attribute.
<p>Intro to Web Design begins <time datetime="2016-08-09 08:00">Tuesday at 8:00 AM</time> in room 3.</p>
Intro to Web Design begins in room 3.
In that code example, the
time element tells the browser that the text “Tuesday at 8:00 AM” is a reference to time. The
datetime element is not shown to the user but is used by the browser to relay the same information as what is contained in the text content of the
time element is used to tell a browser that the associated text is time-related. In-and-of itself, that doesn’t do a lot for users or browsers, although it may be a help to users of some assistive technologies. The
time element isn’t particularly useful until paired with a
datetime attribute. One a
datetime attribute has been associated with the
time element, the browser knows a lot more about the time described in the
time element and can use that information when interacting with other applications — such as when importing information from an HTML email or webpage into a calendar application.
datetime attribute can be used to identify a year, a month and year, a specific date, a date and time, a time without a date, and durations of time.