Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DateTime does not display for midnight

I have a tool tip that is displaying the the start time property of its underlying object. In an MVVM, WPF Caliburn application.

The XAML looks like this: <Label Content="{Binding Subject.StartTime}"/>

where start time is a DateTime object referenced from the underlying model. This works great with date and time displaying correctly... except for midnight. At midnight the time is not being displayed. So rather than 01/01/2001 00:00 AM which is the format that is displayed at other times I'm getting 01/01/2001.

Can any one help me with how to ensure that the time is always displayed?

Thanks.

like image 389
Klee Avatar asked Mar 26 '26 00:03

Klee


1 Answers

The easiest way would be to force a format on the label:

<Label Content="{Binding Subject.StartTime}" 
       ContentStringFormat="dd/MM/yyyy hh:mm:ss tt" />
like image 185
Matt Hamilton Avatar answered Mar 28 '26 15:03

Matt Hamilton



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!