English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Manual de referência do HTML

大全 do HTML

HTML: <time> tag

O tag <time> do HTML ( <time>) é usado para representar24Hora ou data calendária, se for uma data, também pode incluir tempo e fuso horário. Este elemento tem a intenção de representar datas e horários em um formato legível por máquina. Aplicações com funcionalidades de agendamento podem aproveitar isso.

Exemplo online

Como definir datas e horários:

!doctype html>
<html>
<head>
  <title>HTML5 uso do tag <time> (Tutorial básico da web oldtoolbag.com)</title>
  <meta charset="UTF-8">
</head>
<body>
<article>
  <h1>Título do artigo</h1>
  <p>Texto que aparece sob article</p>
</article>
<footer>
  <p>Este artigo foi publicado em <time>2019-12-28</time>.</p>
  <p>Nossa empresa abre às <time>08:30</time>.</p>
</footer>
</body>
</html>
Teste para ver ‹/›
Neste HTML5No exemplo de documento, criamos dois <time> tags-O primeiro <time> mostra a data, o segundo <time> mostra a data em24Tempo representado no sistema de 12 horas.

Compatibilidade do navegador

Browsers supported by <time>:

IEFirefoxOperaChromeSafari

Tag definition and usage instructions

The <time> tag defines the Gregorian calendar time (24 hour system) or date, and the time zone offset is optional.

This element can encode dates and times in a machine-readable way, 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.

HTML 4.01 with HTML5differences

<time> tag is HTML5 new tags.

Attribute

New: HTML5 new attributes.

AttributeValueDescription
datetimeHTML5datetimeSpecify the date/Time. Alternatively, the date can be given by the content of the element/Time.
pubdatedatetime(This attribute is still being considered by WHATWG and W3(indicating the date within the <time> element). / Time is the publication date of the document (or the nearest ancestor <article> element)

Global attributes

<time> tag support HTML global attributes.

Event attributes

<time> tag support HTML event attributes.