Search code examples
excel-dna

ExcelDNA pass excel cell value displalys unexpected output


I use a function public static object getContent(String keyword, object StartTime, object EndTime) { alert(StartTime); }

set cell A1 to 18-07-2012.And when calling =getContent("africa",A1,"04-09-2012") dispalys 41108.what it means?Why its not taking value in A1!!!


Solution

  • Excel has no built-in date/time data type. In Excel, date/times are formatting options for the double data type. You can declare an Excel-DNA function as taking a DateTime parameter to have the passed-in doubles converted to DateTime automatically, or you can do the conversion yourself using DateTime.FromOADate() (since the Excel double encoding matches the COM/OLE date implementation).