THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

Input Time value Property

Input Time Object Reference Input Time Object

Example

Set a time for a time field:

document.getElementById("myTime").value = "22:53:05";
Try it yourself »

Definition and Usage

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

The value attribute specifies a time for the time field.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The value property is supported in all major browsers.

Note: The <input type="time"> element is not supported in Internet Explorer or Firefox.


Syntax

Return the value property:

timeObject.value

Set the value property:

timeObject.value=hh:mm:ss.ms

Property Values

Value Description
hh:mm:ss.ms Specifies a time for the time field.

Explanation of components:
  • hh - hour (e.g. 22 for 10.00pm)
  • mm - minutes (e.g. 30)
  • ss - seconds (e.g. 03)
  • ms - milliseconds (e.g 20)
Examples: "09:55:32.55", "22:15:35" or "16:00".

Technical Details

Return Value: A String, representing the time (with no timezone information) of the time field

More Examples

Example

Get the time of a time field:

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

The result of x will be:

16:32:55
Try it yourself »

Example

An example that shows the difference between the defaultValue and value property:

var x = document.getElementById("myTime");
var defaultVal = x.defaultValue;
var currentVal = x.value;
Try it yourself »

Related Pages

HTML reference: HTML <input> value attribute


Input Time Object Reference Input Time Object