Latest web development tutorials

HTML DOM Input Datetime value property

Input Datetime Object Reference Input Datetime Object

Examples

Set the date and time datetime fields:

. Document.getElementById ( "myDatetime") value = "2014-01-02T11: 42Z";

try it"

Definition and Usage

value attribute is used to set the property value or return value datetime field.

value attribute describes the date and time datetime fields.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute value.

Note: Internet Explorer, Firefox, Opera 15 ( and higher) or Chrome supports the <input> element using type = "datetime".


grammar

Returns the value property:

datetimeObject .value

Set the value property:

datetimeObject .value = YYYY-MM-DDThh : mm: ssTZD

Property Value

value description
YYYY-MM-DDThh: mm:ssTZD It describes the date and time. Interpreted as follows:
  • YYYY - Year (for example: 2011)
  • MM - month (for example: 01 for January)
  • DD - day (for example: 08)
  • T - If you specify the time required for this separator
  • hh - hours (for example: 22 pm to 10.00pm)
  • mm - min (example: 55)
  • ss - seconds (example: 03)
  • TZD - time zone indicator (Z represents Zulu, also known as Greenwich Mean Time)

technical details

return value: String, indicating the date and time datetime fields


More examples

Examples

Get the date and time datetime fields:

var x = document.getElementById ( "myDatetime") value.;
x The output is:
2014-02-06T10: 57Z

try it"


Related Pages

HTML Reference Manual: HTML <the INPUT> value The property


Input Datetime Object Reference Input Datetime Object