Time Formatting

Time Picker for .NET MAUI allows you to use standard or custom time format strings. Set formatting to the spinners that are displayed when the picker is opened - through the SpinnerFormat property and when time is selected through the DisplayStringFormat property.

DisplayString Format

  • DisplayStringFormat(string): Defines the format of the string that will be visualized when the picker dialog is closed.

The format set for DisplayStringFormat should be a valid time format - Standard Time Formst Strings and Custom Time format Strings.

Example

<telerikInput:RadTimePicker DisplayStringFormat="H:mm"/>

and namespace:

xmlns:telerikInput="clr-namespace:Telerik.XamarinForms.Input;assembly=Telerik.Maui.Controls.Compatibility"

Spinner Format

  • SpinnerFormat(string): Defines the string format for the spinners. The default format is "g". Depending on what format is set, the picker visualizes spinner controls with prepopulated values to be picked.

Standard Тime Format Strings

The available standard date and time format strings that can be set to the SpinnerFormat property are described in the table below:

Supported Standard Time Format String Description
"G" Short Date and Long Time Format Specifier
"g" Short Date and Short Time Format Specifier
"T" Long Time Format Specifier
"t" Short Time Format Specifier

For more information on different format go to Standard Date and Time Format Strings topic on Microsoft Docs.

Custom Time Format String

The available custom time format strings that can be set to the SpinnerFormat property are described in the table below:

Supported Custom Time Format Strings
"H"
"HH"
"h"
"hh"
"m"
"mm"
"s"
"ss"
"t"
"tt"

For more details on different formats go to Custom Date and Time Format Strings topic on Microsoft Docs.

Supported Separators

When SpinnerFormat is set and device culture is changed, the separators used for the format string won't be changed. Check below a list of the available separators:

Supported Time Separators Formats
"-"
"."
"'"
" "
":"
"/"

Example

SpinnerFormat="H:mm"

<telerikInput:RadTimePicker SpinnerFormat="H:mm" />

And the result:

See Also

In this article
Not finding the help you need?