Time dateTime property
Example
Obtain the
var x = document.getElementById("myTime").dateTime;
x The output is:
2014-02-14
Try it »
Definition and Usage
The dateTime property sets or returns
the datetime property specifies a date or time. This property is used when no date or time is specified in the content of the element.
**Note:** The datetime property does not render any special effect in all browsers.
Note:
Browser support





Only Firefox and Opera 12 support the dateTime property.
**Note:** Starting from version 15, Opera no longer supports this property.
Syntax
Return the dateTime property:
timeObject
.dateTime
Set the dateTime property:
timeObject
.dateTime=
YYYY-MM-DDThh:mm:ssTZD
Attribute values
| Value | Description |
|---|---|
| YYYY-MM-DDThh:mm:ssTZD | Date or time. The components are explained below:
|
Technical Details
| Return Value: | String, representing the computer-processable form of the date and time of the element. |
|---|
More examples
Example
changing
document.getElementById("myTime").dateTime="1999-06-24T09:30Z";
Try it »
Related Articles
HTML Reference Manual:HTML
The Time object