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

Property
value Yes 10.0 Yes Yes Yes

Note: The <input type="time"> element does not show as any time field in 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