Latest web development tutorials

HTML DOM Input DatetimeLocal value property

Input DatetimeLocal Object Reference Input DatetimeLocal objects

Examples

Set Time field of local date and time:

document.getElementById("myLocalDate").value = "2014-01-02T11:42:13.510";

try it"

Definition and Usage

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

value attribute describes the local date and time Time fields.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute value.

Note: Internet Explorer or Firefox browser does not support <input type = "datetime-local "> element.


grammar

Returns the value property:

datetimelocalObject .value

Set the value property:

datetimelocalObject .value=YYYY-MM-DDThh:mm:ss.ms

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 of the local time field


More examples

Examples

Get local date and time Time fields:

var x = document.getElementById("myLocalDate").value;
x The output is:
2014-11-16T15:25:33

try it"


Related Pages

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


Input DatetimeLocal Object Reference Input DatetimeLocal objects