如何在ASP.NET中从数据库中仅显示gridview中的时间。
问题描述:
how to display only time in gridview in asp.net from database.
什么我试过了:
What I have tried:
how to display only time in gridview in asp.net from database.
答
请查看这些链接并查看代码以供参考
https://www.aspforums.net/Threads / 113200 /只显示ASPNet-GridView-from-Database-using-C-and-VBNet / [ ^ ]
Please check these Links and check the code for reference
https://www.aspforums.net/Threads/113200/Display-only-Time-in-ASPNet-GridView-from-Database-using-C-and-VBNet/[^]
<asp:TemplateField HeaderText="Date Of Birth">
<ItemTemplate>
<asp:Label ID="Label1" Text='<%# Eval("BirthDate", "{0:HH:mm}") %>' runat="server" />
</ItemTemplate>
</asp:TemplateField>
如果没有您要显示的代码,我只能概括答案并建议您查看ToShortTimeString()
方法
DateTime.ToShortTimeString方法(系统)| Microsoft Docs [ ^ ]
Without the code you are using to display, I can only generalize the answer and suggest that you look into theToShortTimeString()
method
DateTime.ToShortTimeString Method (System) | Microsoft Docs[^]