Search.../

value

Sets or gets a time picker's value.

Description

Setting the value property sets the time displayed in the time picker element. The time picker displays the hours and minutes from the value even if the value contains seconds or milliseconds information.

Set value to a 24-hour time string in one of the following formats:

  • HH:MM
  • HH:MM:SS
  • HH:MM:SS.mmm

Where HH is a two-digit hour value (0-23), MM is a two-digit minute value (0-59), SS is a two-digit second value (0-59), and mmm is a three-digit millisecond value (0-999). (Seconds are rounded down to the nearest minute and milliseconds are rounded down to the nearest seconds.)

Getting the value property returns the current displayed time. The time is returned as an HH:MM:SS.mmm string in 24-hour format regardless of how it is currently being displayed.

Notes:

  • If an element is connected to a dataset, setting the element's value in code does not set the value of the connected field in the dataset. That means if you use the dataset to perform a submit, the value changed in code is not reflected in the submitted item.
  • To submit the new value using a dataset, set the field's value using the setFieldValue() function before performing the submit.

Type:

stringRead & Write

Was this helpful?

Get a time picker's value

Copy Code
1let value = $w("#myTimeInput").value; // "16:30:00.000"
Set a time picker's value

Copy Code
1$w("#myTimeInput").value = "16:30";