Articles in this section

How to set 24 hours format DateTime in DateTimeEdit control

To set the 24 hour format DateTime in DateTimeEdit control, the pattern of DateTimeEdit should be set to CustomPattern. The same has been demonstrated in the following code example:

XAML:

<Window x:Class="NewText_WPfapplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:syncfusion="http://schemas.syncfusion.com/wpf"
Title="MainWindow" Height="350" Width="525">
<Grid x:Name="Grid1">
<syncfusion:DateTimeEdit x:Name="Date1" Width="100" Height="23" Pattern="CustomPattern" CustomPattern="HH:mm" />
</Grid>
</Window>

 

C#:

 
using Syncfusion.Windows.Tools.Controls;
using Syncfusion.Windows.Shared;
namespace NewText_WPfapplication
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
DateTimeEdit Date1 = new DateTimeEdit();
Date1.Width = 100;
Date1.Height = 23;
Date1.Pattern = DateTimePattern.CustomPattern;
Date1.CustomPattern = "HH:mm";
Grid1.Children.Add(Date1);
}}}

 

Output:

The following output shows the time format which greater than 12 hours.

WPF DateTime Edit time format

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied