DOM Interfaces
HTMLTimeElement
Represents machine-readable time or date information and exposes the datetime attribute. The dateTime property is a string; it does not automatically construct or validate a JavaScript Date. Example result: 2026-01-01.
Formal Syntax & Structure
html syntaxhtml
const element = document.getElementById('demo'); // HTMLTimeElementReturn Value
HTMLTimeElement
An existing HTML DOM object associated with the time element in this example; this interface is a type, not a function return contract.
Working Example
Example Snippethtml
<time id="demo" datetime="2026-01-01">New Year</time><p> Result: <output id="result"></output></p><script> const e = document.getElementById('demo'); const result = value => { document.getElementById("result").textContent = String(value); }; result(e.dateTime);</script>