开发者

Time gets included when importing Date Cells from Excel to ASP SQL DB

I'm importing an Excel file to SQL through ASP.NET and a cert开发者_如何学Goain column includes dates (2/31/2000) with a cell format of (*d/mm/yyyy).

When I import the Excel file in ASP.NET, the data suddenly becomes like this in the gridview

2/31/200 12:00:00 AM


You can format Date in Gridview...

<asp:BoundField DataField="Date" HeaderText="Date" DataFormatString="{0:dd/MM/yyyy}" />


You didn't really ask a question. Is this after a round trip from uploading through asp.net storing in SQL server and then retrieving from DB and displaying in gridview? .net uses the datetime type If you want to display only the date portion you can use

DateTime exceldate = new DateTime();
exceldate.ToShortDateString();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜