The <time> represents a specific period in time. It may include the datetime attribute to translate dates into machine-readable format, allowing for better search engine results or custom features such as reminders.
It may represent one of the following:
| Content categories | Flow content, phrasing content, palpable content. |
|---|---|
| Permitted content | Phrasing content. |
| Tag omission | None; both the starting and ending tags are mandatory. |
| Permitted parents | Any element that accepts phrasing content. |
| Permitted ARIA roles | Any |
| DOM interface | HTMLTimeElement |
Like all other HTML elements, this element supports the global attributes.
datetimeThis element is for presenting dates and times in a machine readable format. For example, this can help a user agent offer to add an event to a user's calendar.
This element should not be used for dates prior to the introduction of the Gregorian calendar (due to complications in calculating those dates).
The datetime value (the machine-readable value of the datetime) is the value of the element’s datetime attribute, which must be in the proper format (see below). If the element does not have a datetime attribute, it must not have any element descendants, and the datetime value is the element’s child text content.
201100012011-112011-11-1811-182011-W4714:5414:54:3914:54:39.9292011-11-18T14:54:39.9292011-11-18 14:54:39.9292011-11-18T14:54:39.929Z2011-11-18T14:54:39.929-04002011-11-18T14:54:39.929-04:002011-11-18 14:54:39.929Z2011-11-18 14:54:39.929-04002011-11-18 14:54:39.929-04:00PT4H18M3S<p>The concert starts at <time datetime="2018-07-07T20:00:00">20:00</time>.</p>
datetime example<p>The concert took place on <time datetime="2001-05-15T19:00">May 15</time>.</p>
| Specification | Status | Comment |
|---|---|---|
| HTML Living Standard The definition of '<time>' in that specification. | Living Standard | No change from HTML 5.1 |
| HTML 5.1 The definition of '<time>' in that specification. | Recommendation | No change from HTML5 |
| HTML5 The definition of '<time>' in that specification. | Recommendation | Initial definition. |
| Desktop | ||||||
|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | |
| Basic support | 62 | Yes | 22 | No | 49
|
7 |
datetime |
62 | Yes | 22 | No | 49
|
7 |
| Mobile | |||||||
|---|---|---|---|---|---|---|---|
| Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | iOS Safari | Samsung Internet | |
| Basic support | 62 | 62 | Yes | 22 | 49
|
4 | No |
datetime |
62 | 62 | Yes | 22 | 49
|
4 | No |
<data> element, allowing to signal other kind of values.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/time