Formatting datetime field in gridview

user710502 picture user710502 · Feb 7, 2012 · Viewed 15.9k times · Source

I have a field in a gridvie that displays the date in the following format

1/2/2012 3:45:13 AM

How can I format it so that it does ot show the seconds?

Thank you

   <telerik:GridBoundColumn 
    DataField="AdmissionDate" 
    HeaderText="Date" 
    SortExpression="AdmissionDate"
              HtmlEncode="False" />

Answer

Tim Schmelter picture Tim Schmelter · Feb 7, 2012

Try this(short date and short time):

DataFormatString="{0:g}"

Although this is for BoundFields in an ASP.NET GridView, i assume(i have no experiences with Telerik controls) that it works also on a Telerik GridBoundColumn, because it also has this property.