1

I am using excel uploading operation having date data. When I upload excel with date 17-Oct-2012 and I am getting 41199.

Prasad Joshi
  • 471
  • 4
  • 12

2 Answers2

1

You need to convert the date format from OLE Automation to the .net format by using DateTime.FromOADate.

double doubleValue = double.Parse(b);
DateTime convertedDate = DateTime.FromOADate(doubleValue );
Zaheer Ahmed
  • 28,160
  • 11
  • 74
  • 110
Umut Catal
  • 421
  • 4
  • 11
1
public static DateTime FromExcelSerialDate(int serialDate){return new DateTime(1899, 12, 31).AddDays(serialDate);}

Or other ways from old issues;

How do I convert an Excel serial date number to a .NET DateTime?

Community
  • 1
  • 1
huse.ckr
  • 530
  • 12
  • 39