<asp:TemplateField HeaderText="日期" SortExpression="Date">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Convert.ToDateTime(DataBinder.Eval(Container.DataItem, "Date")).ToString("yyyy-MM-dd") %>'></asp:Label>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Center" Width="160px" />
<ItemStyle CssClass="post_list" HorizontalAlign="Center" Width="160px" />
</asp:TemplateField>
转载于:https://www.cnblogs.com/bobo41/p/3392355.html