ComponentOne DateTimeEditors for UWP
C1DateTime Picker Help / C1DateTimePicker Task-Based Help / Selecting the Time Format
In This Topic
    Selecting the Time Format
    In This Topic

    By default, the C1DateTimePicker control's time picker displays the time in a long format that includes seconds, but it can also display time in a shorter format. In this topic, you will learn how to change the time format in the designer, in XAML, and in code.

    In the Designer

    To change the time format, complete the following steps:

    1. Click the C1DateTimePicker control once to select it.
    2. In the Properties window, click the C1DateTimePicker.TimeFormat drop-down arrow and select a mode from the list. For this example, select ShortTime.

    In XAML

    To change the time format, place TimeFormat="ShortTime" to the <DateTimeEditors:C1DateTimePicker>tag so that the markup resembles the following:

    Markup
    Copy Code
    <DateTimeEditors:C1DateTimePicker TimeFormat="ShortTime">
    

    In Code

    To change the time format, complete the following steps:

    1. Open the MainPage.xaml.cs page.
    2. Import the following namespace:
    Visual Basic
    Copy Code
    Imports C1.XAML.DateTimeEditors
    
    C#
    Copy Code
    using C1.WAML.DateTimeEditors;
    
    1. Place the following code beneath the C1DateTimePicker_Loaded event:
    Visual Basic
    Copy Code
    C1DateTimePicker1.TimeFormat = C1TimeEditorFormat.ShortTime
    
    C#
    Copy Code
    c1DateTimePicker1.TimeFormat = C1TimeEditorFormat.ShortTime;
    
    1. Run the project.

    This Topic Illustrates the Following:

    In this topic, you set the C1DateTimePicker.TimeFormat to ShortTime, which provides a shortened time display. The final result will resemble the following image:

     

    See Also