Input Date valueProperty

Input Date 对象参考手册Input Date Object

Example

Set the date of the date field:

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

Try it yourself »

Definition and Usage

The value property sets or returns the value of the value attribute of the date field.

The value property describes the date of the date field.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property

Note:Internet Explorer or Firefox browsers do not support the <input type="date"> element.


Syntax

Return the value property:

inputdateObject.value

Set the value property:

inputdateObject.value=YYYY-MM-DD

Property Values

Value Description
YYYY-MM-DD Specifies the date of the date field.

Explanation:
  • YYYY - year (e.g., 2011)
  • MM - month (e.g., 01 is January)
  • DD - day (e.g., 08)
Example: "2014-02-09".

Technical Details

Return value: A string, representing the date of the date field.


More Examples

Example

Get the date of the date field:

var x = document.getElementById("myDate").value;
xThe output result is:
2000-05-05

Try it yourself »


Related Pages

HTML Reference Manual:HTML <input> value Attribute


Input Date 对象参考手册Input Date Object Other Extensions