Method 1:
<Asp: gridview id = "gridview1" runat = "server">
<Columns>
<Asp: boundfield datafield = "creationdate"
Dataformatstring = "{0: M-dd-yyyy }"
Htmlencode = "false"
Headertext = "creationdate"/>
</Columns>
</Asp>
Set htmlencode to false.
Method 2:
Use template Columns
<Asp: gridview id = "gridview3" runat = "server">
<Columns>
<Asp: templatefield headertext = "creationdate">
<Edititemtemplate>
<Asp: Label id = "label1" runat = "server"
TEXT = '<% # eval ("creationdate", "{0: M-dd-yyyy}") %>'>
</Asp>
</Edititemtemplate>
<Itemtemplate>
<Asp: Label id = "label1" runat = "server"
TEXT = '<% # BIND ("creationdate", "{0: M-dd-yyyy}") %>'>
</Asp>
</Itemtemplate>
</Asp>
</Columns>
</Asp>
Appendix-common formatting formula:
{0: c} currency;
{0: D4} the integer is displayed in the 4-character width field filled with 0;
{0: 000. 0} rounded to the decimal point to retain the nth valid number;
{0: N2} Keep two valid decimal places; {0: N2} % keep two valid decimal places plus a percent sign;
{0: d} long date; {0: d} short date; {0: yy-mm-dd} For example 07-3-25; {0: yyyy-mm-dd} example: 2007-3-25