Reputation: 2593
I'm importing an Excel file to SQL through ASP.NET and a certain 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
Upvotes: 2
Views: 1309
Reputation: 1786
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();
Upvotes: 1
Reputation: 52241
You can format Date in Gridview...
<asp:BoundField DataField="Date" HeaderText="Date" DataFormatString="{0:dd/MM/yyyy}" />
Upvotes: 2