The datetime
attribute attaches a datetime value to an element.
This value is not visible, but it is machine-readable.
Elements that accept datetime include <del>, <ins>, and <time>.
A <del> element with a datetime attribute.
The datetime value signifies when the deletion occurred.
Your order has been
canceled
cancelled.
<p>
Your order has been
<del datetime="2020-11-25T09:10:43">canceled</del>
cancelled.
</p>
For additional details see our HTML time datetime Reference.
The datetime
attribute attaches a date (required) and time (optional) value to an element.
Its value is not visible to the user; it only adds a semantic timestamp to the element.
The datetime
values are readable by screen readers, search engines, JavaScript code, and others.
<tagname datetime="YYYY-MM-DDThh:mm:ssTZD" >
VALUE: | YYYY-MM-DDThh:mm:ssTZD |
---|---|
DESCRIPTION: |
The date and time attached to the element. The format can be broken down as follows:
|
EXAMPLES: |
local time 2021-01-18 11:54:41.809 international time 2021-01-18 18:54:41.809Z duration PD18H23M40 |
The following elements accept the datetime
attribute.
Elements | Description | |
---|---|---|
<del> | Specifies a deleted text -- see example above. | |
<ins> | Specifies an inserted text. | |
<time> | Specifies a date and time |
An <ins> tag with a datetime attribute.
HTTP stands for Hypertext
Translate
Transfer
Protocol.
<p>
HTTP stands for Hypertext
<del>Translate</del>
<ins datetime="2020-10-02T08:11:08Z">Transfer</ins>
Protocol.
</p>
For additional details see our HTML ins datetime Reference.
A <time> tag with a datetime attribute.
The date is: .
The time is: .
<p>
The date is: <time datetime="2020-08-07">August 7, 2020</time>.<br />
The time is: <time datetime="15:22">3:22 PM</time>.
</p>
For additional details see our HTML time datetime Reference.
Here is when datetime
support started for each browser:
Chrome
|
62.0 | Oct 2017 |
Firefox
|
22.0 | Jun 2013 |
IE/Edge
|
18.0 | Jan 2020 |
Opera
|
49.0 | Nov 2017 |
Safari
|
7.0 | Oct 2013 |