I'm using following code to import excel and read the file https://www.c-sharpcorner.com/blogs/upload-and-read-excel-file-in-mvc1
while getting data from date column it automatically converted to string.here this column is formatted as date in excel so if there is date '9/9/2019' im getting 43717
here is my minimal code:
for (int rowIterator = 2; rowIterator <= noOfRow; rowIterator++)
{
var ex = new ExcelData();
ex.CostCode = workSheet.Cells[rowIterator, 1].Value.ToString();
ex.EmployeeNumber = workSheet.Cells[rowIterator, 2].Value.ToString();
ex.Class = workSheet.Cells[rowIterator, 3].Value.ToString();
ex.Date = workSheet.Cells[rowIterator, 4].Value.ToString();
ex.Hours = workSheet.Cells[rowIterator, 5].Value.ToString();
ex.PayType = workSheet.Cells[rowIterator, 6].Value.ToString();
dataList.Add(ex);
}
for more code you can visit the above link.