格式日期/时间在XAML在Silverlight [英] Format Date/Time in XAML in Silverlight
本文介绍了格式日期/时间在XAML在Silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Silverlight 4应用程序。我有我绑定到我的UI一个C#DateTime对象。我想这个日期是在 DD / MM / YYYY
时间(时区)的格式。举例来说,今天将显示为
04/07/2011在下午1时13分(美国东部时间)
有没有办法做到这一点 XAML
? ?或者我需要建立一个转换器
解决方案
< TextBlock的文本={结合日期,的StringFormat ='{} {0:MM / DD / YYYY a\\th:毫米TT}'}/>
将返回
04/07 / 2011在下午1点28(-04)
I have a Silverlight 4 application. I have a C# DateTime object that I'm binding to my UI. I want this DateTime to be in the format of dd/mm/yyyy
time (TimeZone). For instance, today would be displayed as
04/07/2011 at 01:13 p.m. (EST)
Is there a way to do this XAML
? Or do I need to build a converter?
解决方案
<TextBlock Text="{Binding Date, StringFormat='{}{0:MM/dd/yyyy a\\t h:mm tt}'}" />
will return you
04/07/2011 at 1:28 PM (-04)
这篇关于格式日期/时间在XAML在Silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文