Web development
Mark up a date with the time element
Use time with a datetime attribute to pair a readable date with a machine-readable value. Choose a date-only value or an offset-bearing timestamp according to what the content actually represents.
Worked example
HTML example · save as example.html and open in a browser
<p>Published <time datetime="2026-11-23">November 23, 2026</time>.</p>
<p>Meeting begins <time datetime="2026-11-23T14:00:00-05:00">at 2 p.m. Toronto time</time>.</p>How it works
The first value represents a calendar date. The second includes a time and explicit offset, describing a particular instant. The text remains friendly to readers while the attribute gives software a less ambiguous representation.
Limits and mistakes
A numeric offset alone does not encode future daylight-saving rules for a recurring meeting. Do not imply timezone conversion happens automatically in the browser simply because a time element is present. Keep visible text consistent with the attribute.
Check the result
Inspect the datetime values and compare them with the displayed labels. Check a date near midnight if you later add automatic localization, since the calendar date can change across time zones.
Sources
Reference documentation for the behavior used in this guide: