日期格式为06-Apr-2009 04:25 PM

Sau*_*ron 1 wpf

如何格式化字符串以显示日期和时间,如下所示?

2009年4月6日下午04:25

Ken*_*art 8

WPF现在具有该类的StringFormat属性Binding,您可以使用如下:

<TextBlock Text="{Binding StringFormat={}{0:dd-MMM-yyyy HH:mm tt}}"/>
Run Code Online (Sandbox Code Playgroud)