
Untitled
By: a guest on
Jun 16th, 2012 | syntax:
None | size: 0.46 KB | hits: 22 | expires: Never
How can you show the date in a gridview as a date only instead of a datetime?
ToString("MM/dd/yyyy");
<asp:boundfield datafield="MyDate" dataformatstring="{0:MM/dd/yyyy}" />
<asp:BoundField HeaderText="Date" DataField="Date_Field" ReadOnly="True" DataFormatString="{0:d}">
</asp:BoundField>
convert(varchar, myDate, 101)
<itemtemplate>
<asp id="Label1" runat="server" Label.Text='<%# Bind("YourDateField", "{0:M-dd-yyyy}") %>'>;
</asp>
</itemtemplate>