The HTML <time>
element represents either a time on a 24-hour clock or a precise date in the Gregorian calendar (with optional time and timezone information).
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 |
Attributes
Like all other HTML elements, this element supports the global attributes.
datetime
- This attribute indicates the time and date of the element and must be a valid date with an optional time string. If the value cannot be parsed as a date with an optional time string, the element does not have an associated time stamp.
Usage notes
This 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 is not appropriate for instances where a specific date cannot be calculated, nor should it be used for dates prior to the introduction of the Gregorian calendar (due to complications in calculating those dates).
Examples
Simple example
HTML
<p>The concert starts at <time>20:00</time>.</p>
Output
datetime
example
HTML
<p>The concert took place on <time datetime="2001-05-15T19:00">May 15</time>.</p>
Output
Specifications
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. |
Browser compatibility
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | ? | (Yes) | 22.0 (22.0) | 9.0 | 22.0 | 7.0 |
Feature | Android | Chrome for Android | Edge | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | 2.1 | ? | (Yes) | 22.0 (22.0) | 10.0 | 11.50 Removed in 15.0 |
4.0-4.1 |
See also
- The
<data>
element, allowing to signal other kind of values.
Document Tags and Contributors
Tags:
Contributors to this page:
johnjago,
inickel,
sideshowbarker,
gene_wood,
libbymc,
slimsag,
mrenty,
Sheepy,
nwtn,
Sebastianz,
murali24,
sjakthol,
Sheppy,
Mahdi,
kscarfone,
teoli,
ethertank,
ziyunfei,
mkato,
jamesspencer,
allergic,
medicdude,
Briggz5d,
noLanwona,
avsaro,
ernestd,
fscholz,
McGurk,
hobophobe
Last updated by:
johnjago,