TimePicker Formats
You can control the format of the TimePicker by using the format property. The property accepts string parameters and, by default, is set to 't'. When the input element is not focused, the TimePicker displays the value in the specified format.
For more information on the supported time formats, refer to the Formatting Options section.
Formatting Options
The format option of the TimePicker supports:
Predefined Time Formats
The predefined time formats are specifiers that convert a valid JavaScript Date object into a human-readable time based on the locale.
<kendo-timepicker format="T"></kendo-timepicker>
The following table lists the supported time format specifiers for the en locale. The results are for the time 9:05:03 AM.
| Specifier | Description | Result |
|---|---|---|
t | Short time pattern: h:mm a. | 9:05 AM |
T | Long time pattern: h:mm:ss a. | 9:05:03 AM |
Custom Time Formats
When the predefined time formats do not fit your requirements, create a custom format string by using one or more custom specifiers.
<kendo-timepicker format="h a"></kendo-timepicker>
<kendo-timepicker format="HH:mm:ss"></kendo-timepicker>
The following table lists the supported specifiers for custom time formats. The results are for the time 9:05:03.123 AM.
| Specifier | Description | Result |
|---|---|---|
a | Renders the day period. | a, aa, aaa—Short day period name (AM).aaaa—Wide day period name (AM).aaaaa—Narrow day period name (a). |
h | Renders the hour by using a 12-hour clock from 1 to 12. | h a—Hour (9 AM).hh a—Zero-padded hour (09 AM). |
H | Renders the hour by using a 24-hour clock from 0 to 23. | H:mm—Hour (9:05).HH:mm—Two-digit hour (09:05). |
m | Renders the minutes from 0 to 59. | H:m—Minutes (9:5).H:mm—Two-digit minutes (9:05). |
s | Renders the seconds from 0 to 59. | HH:mm:s—Seconds (09:05:3).HH:mm:ss—Two-digit seconds (09:05:03). |
S | Renders the fractional seconds. It truncates based on the number of letters. | s.S—Fractional seconds (3.1).s.SS—Two-digit fractional seconds (3.12).s.SSS—Three-digit fractional seconds (3.123). |
Read-Only Format Specifiers
The following format specifiers are supported for display purposes only. The TimePicker does not allow users to edit values formatted with these specifiers. The results are for the time 9:05 AM.
| Specifier | Description | Result |
|---|---|---|
k | Renders the hour by using a 24-hour clock from 1 to 24. | k:mm—Hour (9:05).kk:mm—Two-digit hour (09:05). |
K | Renders the hour by using a 12-hour clock from 0 to 11. | K a—Hour (9 AM).KK a—Two-digit hour (09 AM). |
z | Renders the time zone. | z, zz, zzz—Short localized GMT format (GMT+2).zzzz—Long localized GMT format (GMT+02:00). |
Z | Renders the time zone. | Z, ZZ, ZZZ—ISO8601 format with hours and minutes (+0200).ZZZZ—Long localized GMT format (GMT+02:00).ZZZZZ—Extended ISO8601 format (+02:00). |
x | The same as the X specifier, except that x does not add the UTC indicator when the offset is 0 (zero). | See X. |
X | Renders the time zone. | X—ISO8601 format with hours and optional minutes (+02).XX, XXXX—ISO8601 format with hours and minutes (+0200).XXX, XXXXX—Extended ISO8601 format (+02:00). |