在 ASP.NET 页面中,我有这个:
<asp:Label ID="MyDateTimeLabel" runat="server"
Text='<%# Eval("MyDateTime") %>' />
我想把它格式化为
... Eval("MyDateTime", "{0:d}") ... // Display only the date
当且仅当 MyDateTime 的时间部分是 00:00:00。否则像这样:
... Eval("MyDateTime", "{0:g}") ... // Display date and time in hh:mm format
这可能吗?我该怎么做?
感谢您提前提示!