Set a local date and time for a datetime field:
The value property sets or returns the value of the value attribute of a local datetime field.
The value attribute specifies a local date and time for the datetime field.
The value property is supported in all major browsers.
Note: The <input type="datetime-local"> element is not supported in Internet Explorer or Firefox.
Return the value property:
Set the value property:
Value | Description |
---|---|
YYYY-MM-DDThh:mm:ss.ms |
Specifies the date and time. Explanation of components:
|
Return Value: | A String, representing the date and time of the local datetime field |
---|
Get the local date and time of a datetime field:
The result of x will be:
An example that shows the difference between the defaultValue and value property:
HTML reference: HTML <input> value attribute