c# - Reading Datetime value From Excel sheet -


when trying read datetime type value excel sheet returning double value.for example if want read value '2007-02-19 14:11:45.730' this, getting double type value .further converting double value using timespan,but not complete because getting value '2007-02-19 12:00:00 am'
want exact same datetime value first one. code :-

timespan datefromexcel = new timespan(convert.toint32((range.cells[rcnt, ccnt] excel.range).value2), 0, 0, 0);    datetime inputdate = new datetime(1900, 1, 1).add(datefromexcel);     arrrow2[ccnt - 1] = inputdate.tostring(); 

please help!!! thanks.

you need convert date format ole automation .net format using datetime.fromoadate.

double d = double.parse(b); datetime conv = datetime.fromoadate(d); 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -