How to format the Date in GridView Asp.net C #

4

In ASP.NET C #,

How do I convert a date in the gridview from the database to the dd/mm/yyyy format? Currently it stays as 18/05/2015 00:00:00 . The column type is BoundField. I already tried with string.Format and DataFormatString="{0:d} and it did not work. Thanks in advance.

Att.

    
asked by anonymous 18.05.2015 / 21:01

1 answer

1

Try using:

<asp:BoundField HeaderText="Date" DataField="MyDate" 
 DataFormatString="{0:dd/MM/yy}">
    
18.05.2015 / 21:04