Codectionary / Developer documentation / HTML

<time>

The <time> element represents a specific date, time, or duration in a machine-readable format via its datetime attribute, while displaying a human-friendly version as its content. This lets browsers, search engines, and assistive technology understand dates unambiguously, even when the visible text is casual (like "yesterday" or "3 days ago").

Syntax

<time datetime="2026-03-03">March 3rd</time>

Examples

Publication Date

Marking up an article's publish date.

<p>Published on <time datetime="2026-03-03">March 3, 2026</time></p>

Relative Time with Machine-Readable Value

Showing a friendly relative time while keeping an exact machine-readable value.

<p>Posted <time datetime="2026-07-16T09:30:00Z">3 hours ago</time></p>

Duration

Representing a duration rather than a specific point in time.

<p>Video length: <time datetime="PT15M30S">15:30</time></p>

Attributes

  • datetime (string): A machine-readable ISO 8601 date, time, or duration

Best practices

  • Always include a datetime attribute in ISO 8601 format, even when the visible text is a casual phrase like "yesterday"
  • Use <time> for any date shown on the page — it helps search engines understand publish dates and freshness
  • Duration values use the ISO 8601 duration format, e.g. PT15M30S for 15 minutes 30 seconds
  • Do not use <time> for vague, non-specific references to time that cannot be expressed as a real date

Browser compatibility

Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.

<time>

Desktop

Chrome
Supported
From 62
Firefox
Supported
From 22
Safari
Supported
From 7
Edge
Supported
From 14
Opera
Supported
From 49

Mobile

Safari on iOS
Supported
From 4
Chrome for Android
Supported
From 62
Firefox for Android
Supported
From 22
Samsung Internet
Supported
From 8.0

MDN BCD record for this feature · MDN reference

Support history and limitations

Chrome

  • From 62

Firefox

  • From 22

Safari

  • From 7

Edge

  • From 14

Opera

  • From 49
  • From 11.5 · Removed in 12 · Last supported version: 11.6

Safari on iOS

  • From 4

Chrome for Android

  • From 62

Firefox for Android

  • From 22

Samsung Internet

  • From 8.0
<time> datetime

Desktop

Chrome
Supported
From 62
Firefox
Supported
From 22
Safari
Supported
From 7
Edge
Supported
From 14
Opera
Supported
From 49

Mobile

Safari on iOS
Supported
From 4
Chrome for Android
Supported
From 62
Firefox for Android
Supported
From 22
Samsung Internet
Supported
From 8.0

MDN BCD record for this feature

Support history and limitations

Chrome

  • From 62

Firefox

  • From 22

Safari

  • From 7

Edge

  • From 14

Opera

  • From 49
  • From 11.5 · Removed in 12 · Last supported version: 11.6

Safari on iOS

  • From 4

Chrome for Android

  • From 62

Firefox for Android

  • From 22

Samsung Internet

  • From 8.0

MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.

HTML Living Standard

Specifications & further reading