Formatting in WPF TimePicker (SfTimePicker)

The SfTimePicker control allows users to format the display text in various ways.

Using the FormatString

The FormatString property determines the format specifier by which the display text has to be formatted.

The example below shows how to create a time picker with a Long Time pattern.

  • xaml
  •   
    
    
    
    	<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    
                <syncfusion:SfTimePicker VerticalAlignment="Center" 
    
                                       Width="200" Margin="15"
    
                                       FormatString="HH:mm:ss"/>
    
    	</Grid>

    SfTimePicker format string

    Specifying format for the TimeSelector

    The SelectorFormatString property used to specify format for the TimeSelector

  • xaml
  • <Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    
        <syncfusion:SfTimePicker HorizontalAlignment="Center" VerticalAlignment="Center" 
    
                                       Width="200" Margin="15"
    
                                       SelectorFormatString="HH:mm:ss"/>
    	</Grid>

    SfTimePicker selection format string

    NOTE

    A detailed explanation of standard date time formatting is availablehere. The result string produced by these format specifiers is influenced by the settings in the Regional Options control panel. Computers with different cultures or different date and time settings will generate different result strings.