HTMLTimeElement:dateTime 属性
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since October 2017.
HTMLTimeElement.dateTime
属性是一个反映 datetime
HTML 属性的字符串,包含元素日期和时间值的机器可读形式。
值
一个字符串。对于有效的字符串格式,请参见 datetime
有效值。
示例
js
// 假设 HTML 中有 <time id="t"> 元素
const t = document.getElementById("t");
t.dateTime = "6w 5h 34m 5s";
规范
Specification |
---|
HTML # dom-time-datetime |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
dateTime |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- Has more compatibility info.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
参见
- 它所属的
HTMLTimeElement
接口。