For some reason i can not format the text of my date in a gridview
<asp:BoundField DataField="deptdate" HeaderText="Departure Date" dataformatstring="{0:ddd, MM/d/yyyy}" htmlencode="False" SortExpression="deptdate" />
I still get this:
May 10 2011 12:00AM
I DID NOT SET MY FIELD TO DATETIME IN THE DATABASE...DOY
Have you tried this approach?
http://peterkellner.net/2006/05/24/how-to-set-a-date-format-in-gridview-using-aspnet-20using-htmlencode-property/
<asp id="GridView1" runat="server" :GridView>
<columns>
<asp headertext="CreationDate" dataformatstring="{0:M-dd-yyyy}"
datafield="CreationDate" :BoundField HtmlEncode="false" />
</columns>
You can use DataFormatString="{0:d}"
for short date format in your column definition.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With