Get the date that a <time> element represents:
The result of x will be:
The dateTime property sets or returns the value of the datetime attribute in a <time> element.
The datetime attribute gives the date or time being specified. This attribute is used if no date or time is specified in the element's content.
Note: The datetime attribute does not render as anything special in any of the major browsers.
Note: The <time> element is new in HTML5.
The dateTime property is only supported in Firefox and Opera version 12.
Note: Opera has no longer support for this property, as of version 15.
Return the dateTime property:
Set the dateTime property:
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ssTZD | The date or time being specified. Explanation of components:
|
Return Value: | A String, representing a machine-readable form of the element's date and time |
---|
Change the date and time of a <time> element:
HTML reference: HTML <time> datetime attribute