Read Excel Date Column

Jul 28, 2009 at 3:59 PM

Hi i use this dll and i have a problem abaut dates.In excel i have column format date and its value = 31.07.2009

But when i get to dataset its value become 40055 so the date value is wrong.

How can i solve this problem

Aug 13, 2009 at 12:54 PM
Edited Aug 13, 2009 at 1:00 PM

Hi,

 

I had the same behaviour, not really a pb.

This is the "Excel date" format.

It seems it is the number of days since a certain date (see below)

 

Just transform this number into a real date like this:

public DateTime TransformExcelDate(int ExcelDateNumber)
{
       DateTime dtref = new DateTime(1900, 1, 1).AddDays(-2);
       return dtref.AddDays(ExcelDateNumber);
}

 

 

Jan 15, 2010 at 10:56 AM

Hi,

i solved this issue with DateTime.FromOADate( "double from excel" )