Input Datetime value property
Example
Set the date and time of the datetime field:
document.getElementById("myDatetime").value = "2014-01-02T11:42Z";
Try it »
Definition and Usage
The value property is used to set or return the value of the value property of the datetime field.
The value property describes the date and time of the datetime field.
Browser support





All major browsers support the value attribute.
Note: Supported by Internet Explorer, Firefox, Opera 15 (and later), or Chrome. element using type="datetime".
Syntax
Return the value attribute:
datetimeObject
.value
Set the value attribute:
datetimeObject
.value=
YYYY-MM-DDThh:mm:ssTZD
Attribute values
| Value | Description |
|---|---|
| YYYY-MM-DDThh:mm:ssTZD | Describes the date and time. Parsed as follows:
|
Technical Details
| Return Value: | 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;
x
The output is:
2014-02-06T10:57Z
Try it »
Related pages
HTML Reference Manual: HTML value attribute
Input Datetime Object