time
Summary
The time tag defines either a time (24 hour clock), or a date in the Gregorian calendar, optionally with a time and a time-zone offset. It does not render differently in any of the major browsers.
This element can be used as a way to encode dates and times in a machine-readable way so that, for example, user agents can offer to add birthday reminders or scheduled events to the user’s calendar.
Overview Table
The HTML time element (
This element is intended to be used presenting dates and times in a machine readable format. This can be helpful for user agents to offer any event scheduling for user’s calendar.
Attributes
datetime
= date or time
Specifies the date or time that the element represents.
Validity
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 valid 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.
Examples
<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>
Related specifications
See also
Related articles
HTML
time