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

HTML DOM Input Time value property

Input Time value property

Input Time Object Reference Input Time Object

Example

Set the time of the time field:

document.getElementById("myTime").value = "22:53:05";

Try it »


Definition and Usage

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

The value property describes the time value of the time field.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value attribute.

Note: Internet Explorer or Firefox browsers do not support the HTML using the type="time" attribute .


Syntax

Return the value attribute:

timeObject

.value

Set the value attribute:

timeObject

.value=

hh:mm:ss.ms

Attribute values

Value Description
hh:mm:ss.ms Describes the time of the time field.
 解析:     
  • hh - hours (e.g. 22 is 10 PM)
  • mm - minutes (e.g. 30)
  • ss - seconds (e.g. 03)
  • ms - milliseconds (e.g. 20)
  • Example: "09:55:32.55" or "22:15:35".

    Technical Details

    Return Value: String, representing the time of the time field (without time zone information).

    More examples

    Example

    Get the time of the time field:

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

    x

    The output is:

    16:32:55

    Try it »


    Related pages

    HTML Reference Manual: HTML value attribute


    Input Time Object Reference Input Time Object