English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The HTML <time> tag ( <time>) is used to represent2412-hour clock time or Gregorian date, if representing a date, it can also include time and time zone. This element is intended to represent dates and times in a machine-readable format. Applications with scheduling features can take advantage of this.
How to define time and date:
!doctype html> <html> <head> <title>HTML5 time tag usage (Basic Tutorial Website oldtoolbag.com)</title> <meta charset="UTF-8"> </head> <body> <article> <h1>Heading for Article</h1> <p>Text that appears under article</p> </article> <footer> <p>This article was published on <time>2019-12-28</time>.</p> <p>Our business opens at <time>08:30</time>.</p> </footer> </body> </html>Test to see ‹/›
Browsers supported by <time>:
IEFirefoxOperaChromeSafari
The <time> tag defines the Gregorian calendar time (24 hour system) or date, and the time zone offset is optional.
The element can encode dates and times in a machine-readable format, so that, for example, user agents can add birthday reminders or scheduled events to the user's schedule, and search engines can generate more intelligent search results.
<time> tag is an HTML5 New tag in
New: HTML5 New attribute in
Attribute | Value | Description |
---|---|---|
datetimeHTML5 | datetime | Specify the date/Another way is to provide the date by the content of the element./Time. |
pubdate | datetime | (This attribute is still being considered by WHATWG and W3(indicating the date within the <time> element). / The time indicates the publication date of the document (or the nearest ancestor <article> element) |
Support for <time> tag Global attributes of HTML.
Support for <time> tag HTML event attributes.