Input Datetime valueProperty
Example
Set the date and time of the datetime field:
document.getElementById("myDatetime").value = "2014-01-02T11:42Z";
Try it yourself »
Definition and Usage
The value property is used to set or return the value of the value attribute of the datetime field.
The value attribute describes the date and time of the datetime field.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the value property.
Note:Internet Explorer, Firefox, Opera 15 (and later versions), and Chrome support the <input> element with type="datetime".
Syntax
Return the value property:
datetimeObject.value
Set the value property:
datetimeObject.value=YYYY-MM-DDThh:mm:ssTZD
Property Values
| Value | Description |
|---|---|
| YYYY-MM-DDThh:mm:ssTZD | Describes the date and time. Parsed as follows:
|
Technical Details
| Return value: | A string representing the date and time of the datetime field |
|---|
More Examples
Example
Get the date and time of the datetime field:
var x = document.getElementById("myDatetime").value;
xThe output is:2014-02-06T10:57Z
Try it yourself »
Related Pages
HTML Reference Manual:HTML <input> value Attribute
Input Datetime Object Other Extensions