Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

datetime: machine-readable time information

Separate a readable label from a precise date, time or modification timestamp.

Version: HTML Living Standard

Syntax

<time datetime="2026-11-18T10:00:00+01:00">Morning meeting</time>

On time, datetime supplies a machine-readable value for the visible content. Allowed forms include dates, times, months, weeks, durations and specified date-time forms; they are not all full JavaScript timestamps. On insertion and deletion elements, the attribute instead describes the change date, optionally with a global time.

Use the syntax allowed for that element. A local date-time without an offset does not identify a unique instant worldwide. Include an offset or UTC marker when expressing one shared instant, and do not assume an offset is a geographic time-zone rule. The attribute does not automatically translate or replace the visible label.

The example compares two full date-times with different offsets that represent the same instant. JavaScript confirms equality while the human-readable label remains unchanged. This does not imply that every legal HTML time value can be parsed the same way.

Examples

<!doctype html><meta charset="utf-8">
<time id="local" datetime="2026-11-18T10:00:00+01:00">Morning meeting</time>
<time id="utc" datetime="2026-11-18T09:00:00Z">UTC reference</time><output id="result"></output>
<script>
const local = document.querySelector('#local'), utc = document.querySelector('#utc');
const sameInstant = Date.parse(local.dateTime) === Date.parse(utc.dateTime);
document.querySelector('#result').textContent = 'sameInstant=' + sameInstant + '; visible=' + local.textContent;
</script>

Result

sameInstant=true; visible=Morning meeting

The comparison intentionally uses full date-times with explicit offsets, not ambiguous local times.

Sources