HTML/Elements/time
From Web Education Community Group
Contents |
<time>
The <time> element represents its contents, along with a machine-readable form of those contents in the datetime attribute.
Point
- The datetime value of a time element is the value of the element's datetime attribute, if it has one, or the element's textContent, if it does not.
- The kind of content is limited to various kinds of dates, times, time-zone offsets, and durations, as described below:
- A valid month string
- 2012-03
- A valid date string
- 3012-03-29
- A calid time string
- 15:25
- 15:25:35
- A valid local date and time string
- 2012-03-29T15:25:35
- 2012-03-29 15:25:35
- A valid time-zone offset string
- Z
- 0000
- 00:00
- See more details: Datetime value at HTML5 specification.
- A valid month string
HTML Attributes
-
datetime= date or time
Specifies the date or time that the element represents.
See also global attributes.
Examples
Example A
[try it]
<p> On <time datetime="1913-03-12">12 March 1913</time>, the city of Canberra was officially given its name by Lady Denman, the wife of Governor-General Lord Denman. </p>
HTML Reference
This element was introduced in HTML5 - 4.6.9 The time element.

