The HTML datetime attribute
Quick answer
The HTML datetime attribute provides a machine-readable date or time. It is used on the <time>, <ins> and <del> elements.
Overview
The datetime attribute provides a machine-readable date or time. It applies to the <time>, <ins> and <del> elements.
It lets machines (and search engines) understand a human-friendly date, and is the basis for rich results like event dates.
Syntax
<time datetime="2026-06-22">June 22, 2026</time>
Values
| Value |
|---|
A valid date/time string, e.g. 2026-06-22, 14:30 or 2026-06-22T14:30. |
Best practices
Frequently asked questions
What does the datetime attribute do?
Gives a machine-readable date/time.
Is the cite attribute displayed on the page?
What format does the datetime attribute use?
ISO-8601 — for example
2026-06-22 for a date or 14:30 for a time.Which elements use the datetime attribute?
It is an element-specific attribute, used on quotation and edit elements like <blockquote>, <q>, <del>, <ins> and <time>.