Easy Tutorial
❮ Prop Style Textdecorationstyle Prop Datetime Name ❯

Input Date value Attribute

Input Date Object

Example

Set the date for the date field:

document.getElementById("myDate").value = "2014-02-09";

Definition and Usage

The value attribute is used to set or return the value of the date field.

The value attribute describes the date of the date field.


Browser Support

All major browsers support the value attribute.

Note: The <input type="date"> element is not supported in Internet Explorer or Firefox.


Syntax

Return the value attribute:

Set the value attribute:

Attribute Values

Value Description
YYYY-MM-DD Specifies the date for the date field. <br> <br>Explanation: YYYY - Year (e.g., 2011)<br> MM - Month (e.g., 01 for January)<br> DD - Day (e.g., 08) Example: "2014-02-09".

Technical Details

| Return Value: | String, representing the date of the date field. | | --- | --- |


More Examples

Example

Get the date of the date field:

var x = document.getElementById("myDate").value;
2000-05-05

Related Pages

HTML Reference: HTML <input> value Attribute


❮ Prop Style Textdecorationstyle Prop Datetime Name ❯