I uploaded an excel spreadsheet using Microsoft.Office.Interop.Excel. When I try to read cells with a date value in order to insert it into my data set, its not being recognized as a date and it comes up as a random number? this is the way that I refer to the cell:
Excel.Range startDate = objsheet.get_Range("C1:C" + lastUsedRow, System.Type.Missing);
double dbl = Convert.ToDouble(startDate);
DateTime conv = DateTime.FromOADate(dbl);
(row[3] = ((Microsoft.Office.Interop.Excel.Range)objsheet.Cells[rowIndex, 4]).Value2;)
From https://stackoverflow.com/a/4538367/1397117
And I echo suggestions below that answer to use
.Value
instead of.Value2
.May do it for you, see this link.
In my project when I had to read data from excel, I created a method which takes cell text as input and C# DateTime as output.