Format Datagrid column to show only date (without time)

  • Thread starter Thread starter NWx
  • Start date Start date
N

NWx

Hi,

I have a Datagrid which display info from a database(SQLServer). Several
column in SqlServer table are smalldatetime type, but I use them only for
date

How can I make Datagrid column to show only date, and not the time (which is
00:00:00 anyway)?

Thank you
 
Hi,

Thank you.
It worked.

Best regards

Ken Cox said:
Try this?

<asp:DataGrid id="DataGrid1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn DataField="OrderDate" ReadOnly="True"
DataFormatString="{0:d}"></asp:BoundColumn>
</Columns>
</asp:DataGrid></P>

More details here:

http://msdn.microsoft.com/library/d...ide/html/cpconcustomdatetimeformatstrings.asp

Does this help?

Ken
MVP [ASP.NET]
Toronto


NWx said:
Hi,

I have a Datagrid which display info from a database(SQLServer). Several
column in SqlServer table are smalldatetime type, but I use them only for
date

How can I make Datagrid column to show only date, and not the time (which
is
00:00:00 anyway)?

Thank you
 
Back
Top