Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Input DatetimeLocal value property

Input DatetimeLocal value property

Input DatetimeLocal Object Reference Input DatetimeLocal Object

Example

Set the local date and time of the time field:

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

Try it »


Definition and Usage

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

The value property describes the local date and time of the time field.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value attribute.

**Note:** Internet Explorer or Firefox browser does not support .


Syntax

Return the value attribute:

datetimelocalObject

.value

Set the value attribute:

datetimelocalObject

.value=

YYYY-MM-DDThh:mm:ss.ms

Attribute values

Value Description
YYYY-MM-DDThh:mm:ssTZD Describes the date and time. Parsed as follows:
  • YYYY - Year (e.g. 2011)
  • MM - Month (e.g. 01 for January)
  • DD - Day (e.g. 08)
  • T - Separator required if time is specified
  • hh - Hour (e.g. 22 for 10.00pm)
  • mm - Minute (e.g. 55)
  • ss - Second (e.g. 03)
  • TZD - Time zone designator (Z stands for Zulu, also known as Greenwich Mean Time)
  • |

    Technical Details

    Return Value: String representing the date and time of the local datetime field

    More examples

    Example

    Get the local date and time of the time field:

    var x = document.getElementById("myLocalDate").value;

    x

    The output is:

    2014-11-16T15:25:33

    Try it »


    Related pages

    HTML Reference Manual: HTML value attribute


    Input DatetimeLocal Object Reference Input DatetimeLocal Object